0

I have created a small application in C#. In that I have coded try...catch blocks on saving as follows.

Try
{
    command.BeginTransection();
    //execute statements here

    command.commit();
}
Catch
    //Here I get error, which is raised from Sql trigger
    command.rollback();
Finally 

In my trigger

CREATE TRIGGER [dbo].[table_insert]
ON [table] FOR INSERT
BEGIN
   //If some condition not matched as per my criteria, I have raise error from trigger
   RAISEERROR
END;

I am getting error in my C# code, and I am rollback my transaction, but still my table is showing locked, and another user work on my application from network getting "connection timeout" error.

So, I don't understand what is the problem is?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Manish Sapkal
  • 5,591
  • 8
  • 45
  • 74
  • Seems to be a duplicate of: [SQL Transactions with Rollback in C#][1] [1]: http://stackoverflow.com/questions/2912112/c-sharp-rollback-sqltransaction-in-catch-block-problem-with-object-accessabi – user3399857 Mar 12 '14 at 04:14
  • @user3399857, that is different issue. – Manish Sapkal Mar 12 '14 at 04:25

0 Answers0