Insert Multiple Records Into The One Table At The Same Time
Does anyone know how to insert multiple records in the same table at the same time. This is what I have. I have a form with 6 fields and they are name prod1 through to prod 6. The table is called related products.
Basically this table is related to the main table called prod_parent. tried looking on google and couldn't find anything.
View Replies
ADVERTISEMENT
I need help to solve this situation....
House 1 (1 photo)
House 2 (4 photos)
Example:
Table1
idHouse....#auto
House.......text
Addr..........Memo
Table2
idPhoto.....#auto
idHouse....num
Photo........text
I need insert multiple records into a single field of the Table2 and
insert the idHouse too. How do I do this?
View Replies
View Related
I'm trying to set up a form whereby users can select a variety of different subject mailing lists they'd like to be added to.
Each subject is in a different table so I want the FROM part of my SQL statement to loop through the values selected from the list box which I've loaded into an array.
But I'm getting a Type mismatch error.Code:
Dim strSQL
Dim subjects
Dim subjArray
Dim iLoop
subjects = Request.Form("subjects")
subjArray = split(subjects)
strSQL = "SELECT firstName, lastName, address1, address2, city, state, pcode, country, email FROM"
For iLoop = LBound(subjArray) to UBound(subjArray)
subjArray(iLoop)
View Replies
View Related
I have a recordset that contains multiple records of product a user is purchasing. For clarity, I converted the recordset fields to variables. I need to take that entire recordset and insert it into another table on a remote server. The below code only inserts 1 record. How do I change the code to get all records inserted?
<%
Dim DataConn2
Set DataConn2 = Server.CreateObject("ADODB.Connection")
DataConn2.Open MM_kasKSS_STRING
SQL = "INSERT INTO wsOrderDetails (OrderID, OrderNo, Description, Qty,
PriceEach, Priceline) "
SQL = SQL & "Values ('" & iod_OrderID & "', '" & iod_OrderNo & "', '" &
iod_Description & "', " & iod_Qty & ", " & iod_PriceEach & ", " &
iod_Priceline & ")"
DataConn2.Execute(SQL)
%>
View Replies
View Related
I need to insert atleast 10000 records at a time but if the user stops the process i need to rollback the transaction.
View Replies
View Related
how to insert multiple records in database?? i have this problem like i have this one form and there are three fields like the (quantity,unit,item name)..the item that will be inputted will vary, depending on the number of item to be inputted..
Ex.
enter the number of item: 3
qty unit item_name
1. 2 pcs pencil
2. 2 pcs glue stick
3. 2 pcs clip
(SUMBIT)
what should i do in order that these items will be inserted in just one insert statement?
View Replies
View Related
I am using a db to hold student data records. I currently display them in a roster based on their affiliation with a certain class. To edit a record I need to click the name of an individual, it opens an edit page, I make the changes, hit submit and return to the roster.
This is pretty standard stuff. What I would like to do is change one field of every record without opening each record individually. The idea comes from my Fantasy Fball league roster:
McNabb, Donovan QB PHI ActiveReserve
Droughns, Reuben RB DEN ActiveReserve
Johnson, Rudi RB CIN PIT ActiveReserve
...etc...
Where the example above says "ActiveReserve" is a pull down menu that lets me change who is playing week to week. I can then change each record, hit submit one time, and update the db. So how do they do it?
View Replies
View Related
I already have this piece of code that inserts multiple rows of data into a single table at once. Code:
View Replies
View Related
I have an .asp page with a form to copy job responsibilites form one
job to another. It is a hotmail type interface with checkboxes
besides each responsibility. After submitting, it should copy the
selected resp's to a different job. After that it should renumber
that job's responsibilities.
This is the code I am using now to copy:
copySQL4 = "INSERT INTO
jambue.RESP(POSCODE,IDCODE1,IDCODE2,RESP_NUM,RESP) SELECT '" & id & "'
POSCODE,'" & dept & "' IDCODE1,'" & unit & "' IDCODE2, '999' RESP_NUM,
RESP FROM jambue.RESP WHERE (POSCODE = '" & POSCODE & "' AND IDCODE1 =
'" & sourceDept & "' AND IDCODE2 = '" & sourceUnit & "') AND RESP_NUM
IN (" & Request.Form("chk") & ")"
As you can see the value '999' is hardcoded in there as the new
Responsibility Number to go with the copied responsibility. I use
this because there are no jobs with that many responsibilities. This
works fine if I only select one resp. to copy over. But if I select
more than one that part still runs fine but I get an error with the
below. It says too many rows would be affected. Of course, this must
be because there are now at least 2 responsibilites with the same
RESP_NUM. Code:
View Replies
View Related
I'm trying to insert mutiple records into my database when the form is submitted.. My form has 4 textfields; serial1, price1, serial2 and price2.
I would like to insert serial1 and price1 as one record, then serial2 and price2 as the second record. I know some sort of loop has to be used to achieve this but i'm new to this and I don't know what to do...
I tried to do it with dreamweaver but it does not seem possible and the dreamweaver code seems really complicated I've only been able to insert only the first row(serial1,price1).. since I only have 2 fixed rows I guess what I need to do is to get dreamweaver to do it twice in a loop. Code:
View Replies
View Related
I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE, UPDATE, DELETE) which are controlled by a web frontend and the table
records are manipulated to control the permissions. Code:
View Replies
View Related
The problem concerns 2 tables, cart_products and cart_shoppingcart.
Cart_products contains all the product data (eg, prices, product's key name, etc), but most importantly, it contains the quantity of stock (prod_quantity) for each item.
cart_shoppingcart contains all of the user's items in their shoppingcart, including those that are part of an (customer) order; these have the order_number to differentiate from those that aren't in any order (their Order_number is 'no_order', the others have the order number).
Now, what I want to do is this:
For every item in the order (ie, every entry in cart_shoppingcart that matches the username and order number), take the quantity (x) the customer is ordering, then take the quantity of stock remaining (y), then subtract x from y to create the new stock level (z) and update the appropriate record in cart_products with z (all this with SQl preferably).
I was thinking of using a Do while loop, but realised that it wouldn't work as I'd have to use several SQL statements and then I'd run into a problem the minute ASP reads "objrec.movenext".
View Replies
View Related
I have aproblem to transfer a data from table x to table y based on id. Its mean when 2 table have same id all data table x must move to table y. I don't know which command need to use is it insert into or update?
<%
Dim conn
Dim rs
Dim MYSQL,MYSQL2
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
Set cmd = Server.CreateObject("ADODB.Recordset")
conn.ConnectionString = "DSN=prmm;UID=administrator;pwd=sa"
conn.Open
startdate=request("tarikh1")
enddate=request("tarikh2")
MYSQL = "SELECT * FROM table_x where paymentdate between '" & tarikh1 & "' and '" & tarikh2 & "'"
rs.open MYSQL,conn ....
View Replies
View Related
Just as the title says I am trying to do something impossible with a single SQL statement. I am doing an ASP webpage for internal use at the company I work for.
I want to know if there is a way to insert/update data into multiple tables in 1 SQL statement.
If it requires functions | views or anything else that is fine but I don't want to have 3-4 different SQL statements to update 2-3 different columns in different tables.
View Replies
View Related
i hav problem with updating the data. In the asp page i hav displayed records based on search criteria. in display mode im displaying the to be updated field in combo box for each similar contract_no. each contract_no will hav different no of rows and to be updated combo box.
based on the selected value in the combo boxes of different contract_nos i hav to update the combo value with old value. user select multiple combo values at a time I need anybody's help with detailed programming logic.
View Replies
View Related
I've got a site with multiple sections (jobs, clubs, motor, property etc), and have banner adverts displaying. Banner adverts have defined start and finish dates to allow advertisers to have period campaigns. They can also choose which section to display in, as well as location of advert (banner, side, base) on page.
But I would also like to break it down further for them to have an option of starting at 01/06/2004 06:00pm to 31/06/2004 09:45pm as an example.
Firstly, I need to find a time selector to enter the times into 'form field'. any help there? I have a date selector, but no time facility...
Secondly, I need to develop the correct select statement.
here is the date part of it:
strSQL = strSQL & " AND START_DATE >= DATE()"
strSQL = strSQL & " AND FINISH_DATE <= DATE()"
The problem I know if I simply put the time being greater than and less than, then the advert will only be seen between those times on those days in database, but I need them to be seen between the time on start day to the time on finish time, and all inclusive.
View Replies
View Related
I am trying to figure out a way to insert all the records from a dynamic table - repeat region into one table as individual records. On the 1st page users select which items they want from a large list. When they click submit it passes the values ( IDs ) with a URL par to the next form. This form has a recordset that uses the URL par from the last page and creates a new dynamic table - repeat regon with all the records they chose. I need to do this so I can then add up rates for those selected items. I need to find a way to the add all those selected records now into one table. Also I need to have them insert each record at a time. So if 4 records are in the recordset and repeat region, I need to have it add 4 records into the table. Hope that makes since. Im a bit lost on this one.
View Replies
View Related
Is it possible when you insert a record in a database to only insert max 5 records. Can i make it delete the oldest one when i want to insert record #6 and so on?
View Replies
View Related
I have created an empty table(.mdb) with 2 columns
Order(AutoNumber) and BuildingID(text)
and i use :
cn.execute "Insert into [Temp](BuildingID) values ("&Buildingid&") "
to insert buildingID into the table
however all buildingid start with 0 with be omitted,
eg. buildingid = "00003333" after insert into the table become "3333"
i have checked that response.write len(buildingid) = 8
What is the problems?
View Replies
View Related
I am trying to make a page post.asp with a form that simply submits one text value and two hidden values into a table. I already have the function that takes the 3 parameters, modifies them and successfully inserts them into the table:
I have included this function in this post.asp page ...
View Replies
View Related
I tried to insert time using now() and failed,
time= date();
conn = Server.CreateObject("ADODB.Connection");
rs = Server.CreateObject("ADODB.Recordset");
conn.Open("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" +
Server.MapPath("generator.mdb") + ";");
sqlQuery = "INSERT INTO table1 ([time]) VALUES (" +
time + ")";
conn.Execute(sqlQuery);
View Replies
View Related
I want to insert the element selected by the user from the drop down box in the DB(Access).Once the user hits submit i want it to insert this in the DB + i want to update one of the fields from True to False . how can i perform both these at the same time?
View Replies
View Related
how to insert current date and time in an insert command into SQl.
insert statement as it sits..
SQL = "INSERT INTO adLogins (adLogins) "
SQL = SQL & "VALUES ('"&user&"')"
objCn.Execute SQL
i have another column, date/time format and would simply like to also shove the date in.. column named dateLogin.
View Replies
View Related
Anyone know if it is possible to update/insert a database record into a dynamically specified field.
The code I have here holds data in an asp session, ownerId, storeid and product type.
I can insert a record into the Productcat table, fields OwnerId and surfboards, no problem.
But what I would like is to insert the ownerid then insert poduct type into the field sepcified in the session variable (session("prodtype")) and/or strprodtpye
For Example
Insert OwnerId + product type into productcat into fileds ownerId and field labled ''strprodtype'' (variable, surfboard, wetsuit, boots, etc)
SQLstatement = "INSERT INTO Productcat (Ownerid,'"&strprodtype&"') "
I have tried using different methods, but the closest I got was IIS error msg ='field not found ("Surfboards", "wetsuits", "boots", etc)' Code:
View Replies
View Related
I am workin on a project at home,asp vbscript website, n im having problems with inserting records into my database .. I am using a dsn-less ADODB connection, but it seems that some kind of security is preventing me from writing in the db.. i can access n retrieve, but NOT WRITE.. ive tried disabling every type of security, still doesnt work..
View Replies
View Related
I get this following error while inserting recoed in ms-acces db :
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only.
/mis/add_iteminfo.asp, line 35
This thing is making me go crazy as i'm running windows platform & running the app on localhost. The have several times but the db isn't read-only, not even in the iis. Don't know what to do .
View Replies
View Related
i have learned database connectivity. I am facing some problems in inserting records to database using SQL. Please tell me the way to insert records using SQL. I received error about wrong arguments on following line.
Rs.Open Query, DBConn, adOpenStatic, adLockOptimistic
where Rs is the RecordSet object, Query contains they SQL String, and DBConn is the Connection to my Microsoft Access database. I easily connected to the database and retrieved records using following command:
Rs.Open Query, DBConn, 3
View Replies
View Related
What is the most efficient way of inserting multiple records into a database ? At the moment, I'm grabbing data and inserting each record with a loop. The only thing is on each loop I'm opening a connection to the db (SQL Server), inserting a record, then closing it.
Is there a way of inserting all the data with either one command or by keeping the connection and looping the command instead. The situation is the user entering email addresses into a textarea, one per line, then process each of those emails as a record.
View Replies
View Related
I would like to clean up my mailing list by changing the URL I use at the moment which is in the format
www.mysite.com/view_pic.asp?pic_number=123
To be
http://www.mysite.com/view_pic.asp?p...il=bob@bob.com
it would then insert the email into a table, collect these for a while and only see these as active members.Any ideas how to do this, I've tried a few things but no luck.
View Replies
View Related
This is my code, for some reason, when I use this exact code it doesn't update my database, but if I use the next section of code it does. Anybody knows why that when I use two different "Insert" in If Then End If, it doesn't work? Oh and I did try the "If PID = 105 OR 151 Then" alone and it works well. Code:
View Replies
View Related
I hv a SQL server table 'spmidishad'. Theere are 7 columns. One of it is Partner. my searchresults.asp displays all the records retrived from my database (spmidishad). At the end of one row, there is a checkbox. Once a few is checked, i will press on the IMPORT button. This import button (the form action is from import.asp)
is to import (insert) all the checked records into the database.. All rows inserted (the data) are the same except for the Partner column.Well, i want someone who can help me to figure out how I am suppose to do this..?
View Replies
View Related
I have a page that will populate information from a "reference" table in the DB (SQL) like this:
sku qty
123 10
111 10
222 10
333 10
This information will be different each time the page is visited based on the variable they submit. So next time it may show 20 records. how would I go about inserting this data to the DB? Can anyone point me in the right direction to get me started?
View Replies
View Related
How to do i send database information to an html email using ASP?
View Replies
View Related