I am still cutting my teeth on ADO, and have a simple data entry form in
VB5 with a recordset sitting behind it. When the user clicks "New" I do a
recordset.AddNew. The user types data, then clicks "Save" and I do a
What I want to know is the ID of this new record. We are using SQL Server
as our back end, and the ID is an auto-increment integer. There are two
solutions I have figured out so far:
1. Take a bookmark just after the .Update, then do a .Refresh of the
recordset, then jump to the bookmark. This is slow and I am pretty sure
it's only by a fluke that it works.
2. Don't use a recordset, instead, bundle all of the data for the new
record into an ADODB.Command object and call an SQL stored procedure to do
an SQL "INSERT INTO" and return the new ID. This works, but my table has
32 columns and this is a difficult to maintain solution, but fast!.
What is the general consensus here? I have two situations really, I have
data entry forms with simple insert/edit/removes, and some batch-type
objects that need to do some multi-table updates, so must be fast!
Tips MOST appreciated! Please email me back at this address:
"You fight today, you fight to die..." - This Mortal Coil