SQL = "INSERT INTO table (a, b, c, d) VALUES ('a', 'b', 'c', 'd')"
conn.Execute(SQL)
Set rsAdd = conn.Execute("SELECT @@IDENTITY")
idnum = rsAdd(0)
Set rsAdd = Nothing
conn.Close
Response.Write "Insert success :" & idnum
Reference :
SELECT LAST_INSERT_ID() in ExecuteScalar() returns 0 only : The Official Microsoft ASP.NET Forums
沒有留言:
張貼留言