By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,983 Members | 1,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,983 IT Pros & Developers. It's quick & easy.

insert multipe records at once how_URGENT

P: 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
Share this Question
Share on Google+
2 Replies


P: 35
r_o
PS: im using ASP
Aug 9 '06 #2

PEB
Expert 100+
P: 1,418
PEB
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.