Users Pricing

forum

home / developersection / forums / ado.net transaction when command's transaction is not set

ADO.Net Transaction when Command's transaction is not set

Anonymous User 3157 19 Jun 2013
Hi Expert, 

I came across a sample on ADO.Net, where a transaction was being done without setting the command's transaction property as in code below.

Is this possible Or one needs to explicitly set the command's transaction property?

// Start a local transaction.
SqlTransaction sqlTran = connection.BeginTransaction();

// Enlist a command in the current transaction.
 SqlCommand command = connection.CreateCommand();
-----
-----
sqlTran.Commit()

Any help on above is really appreciated.

I am a content writter !


1 Answers