sqlhelper 实现回滚事务
SqlConnection con = new SqlConnection(SqlHelper.yfConString);
con.Open();
SqlTransaction tran = con.BeginTransaction();
try
{
SqlHelper.ExecuteNonQuery(tran, CommandType.Text, sb.ToString(), par);
SqlHelper.ExecuteNonQuery(tran, CommandType.Text, sb1.ToString(), par);
SqlHelper.ExecuteNonQuery(tran, CommandType.Text, sb2.ToString(), par);
SqlHelper.ExecuteNonQuery(tran, CommandType.Text, sb3.ToString(), par);
tran.Commit();
}
catch
{
tran.Rollback();
}
finally
{
if(con.State==ConnectionState.Open)
{
con.Open();
}
}