L
Leeor Chernov
Hi,
I am using transaction object with this code:
connection.Open();
SqlCommand command = connection.CreateCommand();
SqlTransaction transaction;
// Start a local transaction.
transaction = connection.BeginTransaction("SampleTransaction");
// Must assign both transaction object and connection
// to Command object for a pending local transaction
command.Connection = connection;
command.Transaction = transaction;
// CallMehtod1( command); //- executing query 1 with
command.ExecuteNonQuery();
// CallMehtod 2(command);//- executing query 2 with
command.ExecuteNonQuery();
transaction.Commit();
My question is it possible to execute different queries with different
method calls , and after commit the transaction like in the sample, rather
than execute the queries in the same method within the transaction, will
this transaction work well ?
Leeor
I am using transaction object with this code:
connection.Open();
SqlCommand command = connection.CreateCommand();
SqlTransaction transaction;
// Start a local transaction.
transaction = connection.BeginTransaction("SampleTransaction");
// Must assign both transaction object and connection
// to Command object for a pending local transaction
command.Connection = connection;
command.Transaction = transaction;
// CallMehtod1( command); //- executing query 1 with
command.ExecuteNonQuery();
// CallMehtod 2(command);//- executing query 2 with
command.ExecuteNonQuery();
transaction.Commit();
My question is it possible to execute different queries with different
method calls , and after commit the transaction like in the sample, rather
than execute the queries in the same method within the transaction, will
this transaction work well ?
Leeor