0

I have opened transaction inside one function ,this function calls stored procedure,which updates data in SqlDataTable.After i return from this function without rollback or commit and call other function, which must return data from same DataTable.After i must call first function to commit or rollback transaction.But my second function does not work.Can you help me?

1 Answers1

0

I suspect your SqlTransaction object is defined in the first function, and when it goes out of scope (is destroyed or disposed) it carries out an auto-rollback. Its difficult to be sure without any code example, but this is a scenairo which would give you the observed behavioiur.

PhillipH
  • 6,182
  • 1
  • 15
  • 25
  • Thank You.Now i use same connection,but i have this in my first function - trans = conn.BeginTransaction(); – user3064723 Jul 17 '14 at 09:06
  • how and where can i define it? – user3064723 Jul 17 '14 at 09:52
  • Open the connection outside both the functions. Create the Transaction outside both the functions and attach to the connection. Call your functions Commit the transaction. Close the connection. – PhillipH Jul 17 '14 at 13:44