Hi,
In my asp page I am inserting a record in to the sql server 2005 db as follows...
OpenDataConnection()
oConn.BeginTrans
set cm = CreateObject("ADODB.Command")
set cm.ActiveConnection = oConn
cm.CommandText ="INSERT INTO t_test( blah blah")
cm.execute
oConn.commitTrans
set cm = nothing
i would now like to get the id of the record just inserted. i know about @@identity but records are being inserted into this table from multiple sources so i don't think i can gurantee this will be foolproof i.e. i insert a record, then another record is inserted from elsewhere immedialty after, i then run @@identity and it will give me the latter rather than the former...i think ?
Would greatly appreciate any ideas on how to do this. Thanks