Well, I m using ADO - VB6.0 and an Access Database.
Through a command object i m commiting SQL STATEMENTS to my mdb file.
When I m issuing an INSERT Statement to insert new record i want to get back the primary key of the record ( Auto increment field declared in Access).
So far i had to deal with SQL server. SQL server has the @@identity variable for that job.
I ve looked in MSDN and found that the same problem is faced with a Select statement after the update p.e.
DIM objCmd as NEW ADODB.Command
DIM objRS as New ADODB.RecordSet
objCmd.CommandText="Insert INTO Cust VALUES('John','Smith')"
objCmd.Execute
objRS.open "SELECT MAX(ID) AS Cust_ID FROM Cust"
lngIdentity = objRS!Cust_ID
objRS.Close
Well i dont like this way, i think it gets to slow.
Any other way to do this ??
Thanks in advance
Through a command object i m commiting SQL STATEMENTS to my mdb file.
When I m issuing an INSERT Statement to insert new record i want to get back the primary key of the record ( Auto increment field declared in Access).
So far i had to deal with SQL server. SQL server has the @@identity variable for that job.
I ve looked in MSDN and found that the same problem is faced with a Select statement after the update p.e.
DIM objCmd as NEW ADODB.Command
DIM objRS as New ADODB.RecordSet
objCmd.CommandText="Insert INTO Cust VALUES('John','Smith')"
objCmd.Execute
objRS.open "SELECT MAX(ID) AS Cust_ID FROM Cust"
lngIdentity = objRS!Cust_ID
objRS.Close
Well i dont like this way, i think it gets to slow.
Any other way to do this ??
Thanks in advance