110,561
社区成员
发帖
与我相关
我的任务
分享
DbConnection cn = db.GetConnection();
cn.Open();
DbTransaction ts = cn.BeginTransaction();
try
{
Insert(...);
for(...) { Update(...); }
/// 执行任意多条数据库操作
ts.Commit();
}
catch
{
ts.Rollback();
throw;
}
finally
{
cn.Close();
}