Search code examples
c#sqlconnectionsqltransaction

Keepalive sql transaction


I have a simple problem with sql transactions. I connect to my database in method A and start a sql transaction. At the end of the method I close the connection, because the calculation (external method) takes a long time.
After finishing the calculation I want to commit or rollback the transaction, but I need the same connection.

Is there any other possibility to get it running?


Solution

  • The only thing I can think of is to not do any writing in the half, then you won't have to do anything if you decide to rollback later on.