本文介绍了交易范围和正常交易有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope())
{
}
和
and
using (IDbTransaction tran = conn.BeginTransaction())
{
try
{
// transactional code...
using (SqlCommand cmd = conn.CreateCommand())
{
cmd.CommandText = "INSERT INTO Data(Code) VALUES('A-100');";
cmd.Transaction = tran as SqlTransaction;
cmd.ExecuteNonQuery();
}
tran.Commit();
}
catch(Exception ex)
{
tran.Rollback();
throw;
}
}
hat是上述两个
hat is the difference between the above two
推荐答案
这篇关于交易范围和正常交易有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!