It contains Asp.net,C#.net,Vb.net,Sql server FAQ's.
How to get the last inserted ID from the table ?
There are two ways to get the ID of the last inserted record.
@Identity()
@Scope_Identity()
EX:
String Squlquery = “insert into tablename(categoryname) values (@categoryname);” + “Select Scope_Identity()”;
So use ExecuteScalar to get the ID of the last inserted Record.
Int getLastID = (int) cmd.ExecuteScalar();
Labels:
Dotnet FAQ
|
Subscribe to:
Post Comments (Atom)
About Me
I am Venkatesan.M
Working as a Senior Developer with 4+ years of experience in Dot Net.
Working as a Senior Developer with 4+ years of experience in Dot Net.
0 comments:
Post a Comment