471,594 Members | 1,931 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

insert multipe records at once how_URGENT

35
hi i'm new to this issue

i'm developping a web application with an access database

in my application there's a loop that gets values of a form
like:

lastElt=request("numberOfItems")
for i=0 to lastElt
qty=request("qty" & i )
desc=request("desc" & i )
objConn.execute("insert into items values(" & qty & " , ' " & desc & " ' )" )
next

and i have to insert like 12-15 records
is there a way to insert them at the same time like a batch operation, or something instead of accessing the database multiple times

well im using a stored procedure that does the insert but i f there's a way to batch-insert i'll take it

need code PLEASE!!

another isuue:

i need to insert a row into a table whose PK is an autonumber and then get the PK value. I'm using aq stored procedure to do the insert and then the @@IDENTITY method to get this value(PK)
my question is : if there were 2 or more users executing the page at the same time, cab user1's inserted PK be seen by user2
ie. 2 ASO connections here , the @@IDENTITY does it depend on the connection calling it or does it retrieve the last inserted PK value no matter who or what connection did the insert or does a it return the value last inserted by the ADO connection issuing the @@IDENTITY call
Aug 9 '06 #1
2 1786
r_o
35
PS: im using ASP
Aug 9 '06 #2
PEB
1,418 Expert 1GB
Why do not try the follow:

objConn.execute("insert into items (F1_items, F2_items) SELECT qty, desc FROM numberOfItems;" )

Where F1_items and F2_items are fields you want to append in table items

Have a nice day!
Aug 31 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Roy Adams | last post: by
6 posts views Thread by eighthman11 | last post: by
24 posts views Thread by Henry J. | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.