I created sqlconnection, CN1. Then this CN1 opens. There is a transaction later in the code. If I execute the sql command for this CN1 connection, is it inside a transaction?
The code is as follows:
SqlConnection cn1 = new SqlConnection(); cn1.Open(); //connection opened when there is no ambient transaction. ... using(TransactionScope scope = new TransactionScope()) { SqlCommand cmd; //a typical sql command. ... cmd.ExecuteNonQuery(); //Is this command within transaction? ... }
mkus
source share