Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I check whether a Transaction is in Progress in C#?

If so then the next transaction should be executed after the previous one is completed.

Thanks in Advance.
Posted
Updated 19-Oct-11 22:18pm
v2
Comments
Dalek Dave 20-Oct-11 4:18am    
Edited for Readability.

If you are using System.Data.SqlClient.SqlTransaction it will take care of these issues for you. Try these for Using Transaction:

Using Transactions in ADO.NET[^]

http://www.c-sharpcorner.com/UploadFile/dchoksi/transaction02132007020042AM/transaction.aspx[^]

hope it helps :)
 
Share this answer
 
Comments
Mehdi Gholam 20-Oct-11 3:32am    
My 5!
Uday P.Singh 20-Oct-11 3:35am    
Thanks Mehdi :)
RaviRanjanKr 20-Oct-11 3:45am    
Nice Link, My 5+
Uday P.Singh 20-Oct-11 3:56am    
thanks Ravi :)
Dalek Dave 20-Oct-11 4:18am    
Excellent Answer.
You don't need to check the transaction status in your code, just create your transactions and the DB server will handle them.

It will kill your performance if you wait for each transaction to finish before starting a new one in your code.

There are things you should be aware of when using transactions like locked pages etc.

Read the following on transaction isolation levels : http://msdn.microsoft.com/en-us/library/ms173763.aspx[^]
 
Share this answer
 
Comments
Uday P.Singh 20-Oct-11 3:35am    
good point with nice link 5+ :)
RaviRanjanKr 20-Oct-11 3:45am    
Nice answer, My 5+
Dalek Dave 20-Oct-11 4:18am    
True, +5
Mehdi Gholam 20-Oct-11 4:57am    
Thanks
 
Share this answer
 
In addition to Uday and Mehdi answer I suggest you to navigate given Stackoverflow link for getting some usefull answer in regarding to your requirement.
Read Solution[^]
then you can read MSDN-[Using the TransactionScope Class][^]
 
Share this answer
 
Comments
Mehdi Gholam 20-Oct-11 3:57am    
Cheers 5!
RaviRanjanKr 20-Oct-11 4:00am    
Thanks :)
Uday P.Singh 20-Oct-11 3:59am    
nice! now the OP have all the stuffs required to work on transactions. Team effort 5+ :)
RaviRanjanKr 20-Oct-11 4:00am    
Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900