Users Pricing

forum

Home Forums ADO.Net Transaction when Command's transaction is not set – MindStick

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

Anonymous User 3245 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.

1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md