I have a field in table that is auto increment. There increment and seed is (1,1) .So My first row enter in database table then this field value is 1. After that i am inserting second row but from the catch block my transaction is rollback(i am using commit in try block after insert statement.). so my second row did not insert. now i am insert again a row that time it inserted and my auto increment field value is 3 and total rows are 2. that is my problem "If row does not insert in to database table then why increment auto increment field of database table ".
If i am say something wrong pls ignore it.
Loading

ashrafuddinPosted Jun 2, 2011, 3:48 AM
I think you can use Transaction Scope in DotNet.It will help you in checking that the record is not inserted unless all the transaction is complete.
Take a look at following link
http://www.codeproject.com/KB/dotnet/TransactionScope20.aspx
With Regards,
Ashrafuddin.T
Sandeep ShekhawatPosted Jun 1, 2011, 6:53 PM
Hi Suthish Sir
select @username=user_name,@password=passowrd from dbo.LoginInfo(@mail)
By this query when user name already exists then second inserting is failed and whole transaction rollback.
Suthish NairPosted Jun 1, 2011, 3:04 PM
Sandeep ShekhawatPosted Jun 1, 2011, 11:00 AM
Sandeep ShekhawatPosted Jun 1, 2011, 6:10 AM
My Store procedure is (parameter a lot of so ignore parameter).
Dorababu MekaPosted Jun 1, 2011, 6:02 AM