I’m trying to get the Identity of records as I insert them into my database. I have tried: OrderID = DataConn.Execute(“SELECT @@IDENTITY FROM Orders”). But this returns a syntax errorat ‘@@IDENTITY’. I am using JScript with NT4 and MS Access.
What you really want is to select the column name with the Identity property. So, if the column that has the identity property is called iFramis, you would ask for SELECT iFramis from Orders. @@identity might just give you the last integer used in the column.
create table junk (iid, identity (1,1))goinsert junk default valuesgoinsert junk default valuesgoselect iid from junkselect @@identity from junk