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 2980 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.

Updated on 19-Jun-2013

I am a content writter !

Can you answer this question?

Answer

1 Answers

Liked By