Bulk insert data using recordset and return new ID's quickly

smith051288

New Member
How can I bulk insert a number of records and obtain the last inserted ID of each quickly (classic asp/ado)?I have tried this but it only runs at about 3 rows per second which is a joke.\[code\]rs.Open "myTable", cn,adOpenKeyset, adLockOptimisticdo while NOT rs.EOF rs.AddNew rs("text") = myFunction() ' returns some text. rs.update lastid = rs("id") ' get new id and so somethingloop\[/code\]Using the normal adOpenForwardOnly (which doesn't return the last inserted ID) it runs about 1000x faster.Can anyone suggest either a fix to the above or an alternative solution? I have to do this in the code rather than straight sql insert into ... select() etc. because I need to run a processing function on the text.
 
Back
Top