Im using SqlDataSource sds = new SqlDataSource(); in code behind and inserting using sds.Insert(); Please tell me how to get inserted record primary key value?
Please note im not using stored procedure.
Im using SqlDataSource sds = new SqlDataSource(); in code behind and inserting using sds.Insert();
Share
Last_Insert_ID();
Gives you the last primary key id, you can simply append this on the end of your current insert and the key value will be returned from your insert.
here is a C# example:
I found this at MSDN:
http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/91bd10ce-c83b-4766-920b-2137ddc29908