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?
Asked
Active
Viewed 643 times
0
-
3Please share the code.. – Aravinth Kannan Jul 17 '14 at 08:02
-
Do you use the same connection for all commands that you use on your DB? – mslliviu Jul 17 '14 at 08:04
-
Thank You @AravinthKannan ,@mslliviu. I used other connections.. – user3064723 Jul 17 '14 at 09:00
1 Answers
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
-
-
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