110,536
社区成员
发帖
与我相关
我的任务
分享
public void ExeSql(string theSql)
{
using (SqlCommand theCommand2 = new SqlCommand())
{
theConn.Open();
SqlTransaction trans = theConn.BeginTransaction(IsolationLevel.ReadCommitted);
try
{
theCommand2.Connection = theConn;
theCommand2.Transaction = trans;
theCommand2.CommandText = theSql;
theCommand2.ExecuteNonQuery();
trans.Commit();
}
catch (Exception ex)
{
trans.Rollback();
throw new ApplicationException(ex.Message);
}
finally
{
theConn.Close();
}
}
}