using (SqlConnection conn = new SqlConnection(SQLHelper.constr))//SQLHelper.constr为数据库连接字符串
{
conn.Open();//连接数据库
//使用事务处理多SQL语句
using (SqlTransaction trans = conn.BeginTransaction())
{
try
{
}
catch (Exception)
{
trans.Rollback();
}
finally
{
conn.Close();
}
}
}