zoukankan      html  css  js  c++  java
  • asp.net调用事务

     public  int ExcuteCommand(string sql)
        {
            int result = -1;
            OleDbConnection myconn = getcon();
            OleDbTransaction trans = myconn.BeginTransaction(IsolationLevel.ReadCommitted);
            try
            {
                OleDbCommand cmd = new OleDbCommand(sql, myconn);
                cmd.Transaction = trans;
                trans.Commit();
                result = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                trans.Rollback();
                throw (ex);
            }
            finally
            {
                myconn.Dispose();
                myconn.Close();
            }
            return result;
        }

  • 相关阅读:
    python基本数据类型剖析
    常用正则表达式
    python_re模块
    迭代器模式
    状态模式
    备忘录模式
    asp.net 发送邮件
    建造者模式
    抽象工厂模式
    摸板模式与钩子
  • 原文地址:https://www.cnblogs.com/zhang9418hn/p/2153285.html
Copyright © 2011-2022 走看看