我有以下插入查询:
string InsertQuery = string.Format("insert into tblUsers (FirstName, LastName, Email, UserPassword, Area, BirthDate, AboutMe, Phone, RideExp, RegisterDate, Gender) values ('{0}','{1}','{2}','{3}',{4},'{5}','{6}',{7}, {8},'{9}')"
, FirstName, LastName, Email, Password, AreaID, BirthDate, AboutMe, RideExp, RegisterDate, Gender);
我的问题是,是否有任何简单的方法可以为此特定新行获取新的row-id
?
希望得到帮助,谢谢!
答案 0 :(得分:2)
试试这个。
Dim dbs as DAO.Database
Dim TranID as Long
TranID = dbs.OpenRecordset("Select @@Identity")(0)
这个问题有很好的使用信息。 SELECT @@IDENTITY not scoped by DB object?