i am trying to get identity column value after doing an insert by using recordset.addnew.
In my sqlserver db table has 60 columns. if i insert value to only first 2 columns then i am getting proper identity. if i insert to for all columns or except these 2 fields then i am getting wrong identity value. for example after insert,
In Sql server newly inserted id value is 32000 but in application i am getting id = 4000001. my code is
rsCoverSheet("name") = contactName
rsCoverSheet("Phone") = contactPhone
rsCoverSheet("ContactCell") = contactCell
rsCoverSheet("ContactEmail") = contactEmail
rsCoverSheet("ContactFax") = contactFax
sID = rsCoverSheet("iSubmitID")
the data is getting saved. no problem with saving. problem with retrieving the identity column isubmitid only. can anybody help me on this ? i got confused with either DB problem or application problem ?
Thanks & Regards
Some databases have a special variable to retrieve the last identity value, for mssql it's select @@identity if I remember correctly.