zoukankan      html  css  js  c++  java
  • 黄聪:C#数据库回滚

    OleDbCommand cmd = new OleDbCommand("", conn);
                conn.Open();
                OleDbTransaction tran = conn.BeginTransaction();
                cmd.Transaction = tran;

                try
                {
                   
                    foreach (string sql in values)
                    {
                        cmd.CommandText = sql;
                        cmd.ExecuteNonQuery();
                    }
                   
                    tran.Commit();
                    return true;
                }
                catch (Exception)
                {
                    tran.Rollback();
                    return false;
                    //MessageBox.Show(e.ToString(), "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    conn.Close();
                }

  • 相关阅读:
    rs485
    RS-232
    Delphi CRC算法, 不错
    Delphi Modbus RTU CRC16校验码
    如何使用Delphi编写Modbus RTU CRC16的校验码
    Delphi CRC算法crcexecute
    Delphi CRC32Verify控件
    Delphi CRC16校验算法实现(转)
    delphi crc校验函数
    JavaScript如何一次性展示几万条数据
  • 原文地址:https://www.cnblogs.com/huangcong/p/1697093.html
Copyright © 2011-2022 走看看