CN1 という sqlconnection を作成しました。次に、この CN1 を開きます。コードの後半に transactionscope があります。この 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?
...
}