我创建了一个sqlconnection,CN1.然后打开CN1.稍后在代码中有一个transactioncope.如果我在这个CN1连接上执行sql命令,这是在事务中吗?
代码看起来像这样;
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? ... }