How to control transaction on data access in DataAdapter and stored procedure C #? Currently I want to execute 2 stored procedure calls through the data adapter, but I want to control the transaction on it. Is there any way to do this?
The preferred method of doing this is to use the transaction to make it scope for you to handle is. Just surround the body of code that invites the stored procedure call with both:
(TransactionScope scope = new TransactionScope ()) {// Your ADO. The net code that calls the spread ...}
Any call from a database on a single connection will automatically be combined into one transaction. You can also specify It is possible that the code within the scope of the transaction should be included in the current transaction or should start by itself through optional parameters.
This is the preferred way of combining calls in a single transaction, by manually dialing your work and then tran.Commit ()
. Calling
Comments
Post a Comment