Trying to get SELECT SCOPE_IDENTITY() as c# variable
问题 I am inserting a row into one table then want to get that new ID so I can add it in another variable where I have email address stored. var db = Database.Open("myDB"); var insertCommand1 = "INSERT INTO myDB (FirstName, LastName) Values(@0, @1)"; db.Execute(insertCommand1, first, last); var lastInsertedId = db.QueryValue("SELECT SCOPE_IDENTITY()"); var insertCommand2 = "INSERT INTO email (id_person, email) Values(@0, @1)"; db.Execute(insertCommand2, lastInsertId, email); where id_person is the