当前位置: 首页>>代码示例>>C#>>正文


C# SQLHelper.Rollback方法代码示例

本文整理汇总了C#中SQLHelper.Rollback方法的典型用法代码示例。如果您正苦于以下问题:C# SQLHelper.Rollback方法的具体用法?C# SQLHelper.Rollback怎么用?C# SQLHelper.Rollback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLHelper的用法示例。


在下文中一共展示了SQLHelper.Rollback方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateDatabase

 /// <summary>
 /// Creates a database out of the structure it is given
 /// </summary>
 /// <param name="Database">Database structure</param>
 /// <param name="ConnectionString">The connection string to the database's location</param>
 public static void CreateDatabase(Database Database, string ConnectionString)
 {
     string Command = BuildCommands(Database);
     string[] Splitter = { "\n" };
     string[] Commands = Command.Split(Splitter, StringSplitOptions.RemoveEmptyEntries);
     ConnectionString = Regex.Replace(ConnectionString, "Pooling=(.*?;)", "", RegexOptions.IgnoreCase) + ";Pooling=false;";
     string DatabaseConnectionString = Regex.Replace(ConnectionString, "Initial Catalog=(.*?;)", "", RegexOptions.IgnoreCase);
     using (SQLHelper Helper = new SQLHelper(Commands[0], DatabaseConnectionString, CommandType.Text))
     {
         Helper.ExecuteNonQuery();
     }
     using (SQLHelper Helper = new SQLHelper("", ConnectionString, CommandType.Text))
     {
         try
         {
             Helper.BeginTransaction();
             for (int x = 1; x < Commands.Length; ++x)
             {
                 Helper.Command = Commands[x];
                 Helper.ExecuteNonQuery();
             }
             Helper.Commit();
         }
         catch { Helper.Rollback(); throw; }
     }
 }
开发者ID:yiwayhb,项目名称:Craig-s-Utility-Library,代码行数:31,代码来源:SQLServer.cs

示例2: Delete

 public void Delete(BESIMREG_REQUESTEDBY entity)
 {
     try
     {
         int entityId = entity.REQUESTEDBYID;
         sqlHelper = new SQLHelper(true);
         daSIMREG_REQUESTEDBY.Delete(sqlHelper, entityId);
         sqlHelper.CommitTran();
     }
     catch (Exception ex)
     {
         //SimReg.Common.Utility.SaveErrorLog(this.GetType().ToString(), "", ex);
         if (sqlHelper != null) sqlHelper.Rollback();
         throw ex;
     }
 }
开发者ID:raselahmmedgit,项目名称:simreg-sample,代码行数:16,代码来源:BOSIMREG_REQUESTEDBY.cs

示例3: GetSIMREG_REQUESTEDBYs

 public BESIMREG_REQUESTEDBYs GetSIMREG_REQUESTEDBYs()
 {
     try
     {
         BESIMREG_REQUESTEDBYs SIMREG_REQUESTEDBYs = null;
         sqlHelper = new SQLHelper();
         SIMREG_REQUESTEDBYs = daSIMREG_REQUESTEDBY.GetSIMREG_REQUESTEDBYs(sqlHelper);
         sqlHelper.CommitTran();
         return SIMREG_REQUESTEDBYs;
     }
     catch (Exception ex)
     {
         //SimReg.Common.Utility.SaveErrorLog(this.GetType().ToString(), "", ex);
         if (sqlHelper != null) sqlHelper.Rollback();
         throw ex;
     }
 }
开发者ID:raselahmmedgit,项目名称:simreg-sample,代码行数:17,代码来源:BOSIMREG_REQUESTEDBY.cs

示例4: GetSIMREG_DOMAINUSERbyDELIVER

 public BESIMREG_DELIVEREDBY GetSIMREG_DOMAINUSERbyDELIVER(string UserName)
 {
     try
     {
         BESIMREG_DELIVEREDBY SIMREG_DELIVEREDBY = null;
         sqlHelper = new SQLHelper();
         SIMREG_DELIVEREDBY = daSIMREG_DOMAINUSER.GetSIMREG_DOMAINUSERbyDELIVER(sqlHelper, UserName);
         sqlHelper.CommitTran();
         return SIMREG_DELIVEREDBY;
     }
     catch (Exception ex)
     {
         //SimReg.Common.Utility.SaveErrorLog(this.GetType().ToString(), "", ex);
         if (sqlHelper != null) sqlHelper.Rollback();
         throw ex;
     }
 }
开发者ID:raselahmmedgit,项目名称:simreg-sample,代码行数:17,代码来源:BOSIMREG_DOMAINUSER.cs

示例5: GetSIMREG_DOMAINUSER

 public BESIMREG_DOMAINUSER GetSIMREG_DOMAINUSER(int UserId)
 {
     try
     {
         BESIMREG_DOMAINUSER SIMREG_DOMAINUSER = null;
         sqlHelper = new SQLHelper();
         SIMREG_DOMAINUSER = daSIMREG_DOMAINUSER.GetSIMREG_DOMAINUSER(sqlHelper, UserId);
         sqlHelper.CommitTran();
         return SIMREG_DOMAINUSER;
     }
     catch (Exception ex)
     {
         //SimReg.Common.Utility.SaveErrorLog(this.GetType().ToString(), "", ex);
         if (sqlHelper != null) sqlHelper.Rollback();
         throw ex;
     }
 }
开发者ID:raselahmmedgit,项目名称:simreg-sample,代码行数:17,代码来源:BOSIMREG_DOMAINUSER.cs

示例6: GetSIMREG_NEWFORM

 public BESIMREG_NEWFORM GetSIMREG_NEWFORM(int SIMREG_NEWFORMId)
 {
     try
     {
         BESIMREG_NEWFORM SIMREG_NEWFORM = null;
         sqlHelper = new SQLHelper();
         SIMREG_NEWFORM = daSIMREG_NEWFORM.GetSIMREG_NEWFORM(sqlHelper, SIMREG_NEWFORMId);
         sqlHelper.CommitTran();
         return SIMREG_NEWFORM;
     }
     catch (Exception ex)
     {
         //SimReg.Common.Utility.SaveErrorLog(this.GetType().ToString(), "", ex);
         if (sqlHelper != null) sqlHelper.Rollback();
         throw ex;
     }
 }
开发者ID:raselahmmedgit,项目名称:simreg-sample,代码行数:17,代码来源:BOSIMREG_NEWFORM.cs

示例7: Save

 public void Save(BESIMREG_DOMAINUSER entity)
 {
     try
     {
         sqlHelper = new SQLHelper(true);
         daSIMREG_DOMAINUSER.Save(sqlHelper, entity);
         sqlHelper.CommitTran();
     }
     catch (Exception ex)
     {
         //SimReg.Common.Utility.SaveErrorLog(this.GetType().ToString(), "", ex);
         if (sqlHelper != null) sqlHelper.Rollback();
         throw ex;
     }
 }
开发者ID:raselahmmedgit,项目名称:simreg-sample,代码行数:15,代码来源:BOSIMREG_DOMAINUSER.cs

示例8: GetSIMREG_NEWFORMs

 public BESIMREG_NEWFORMs GetSIMREG_NEWFORMs(string msisdnTitle, string requestById, string requestTypeId, string deliverById, string requestFromDate, string requestToDate, string deliverFromDate, string deliverToDate)
 {
     try
     {
         BESIMREG_NEWFORMs SIMREG_NEWFORMs = null;
         sqlHelper = new SQLHelper();
         SIMREG_NEWFORMs = daSIMREG_NEWFORM.GetSIMREG_NEWFORMs(msisdnTitle, requestById, requestTypeId, deliverById, requestFromDate, requestToDate, deliverFromDate, deliverToDate, sqlHelper);
         sqlHelper.CommitTran();
         return SIMREG_NEWFORMs;
     }
     catch (Exception ex)
     {
         //SimReg.Common.Utility.SaveErrorLog(this.GetType().ToString(), "", ex);
         if (sqlHelper != null) sqlHelper.Rollback();
         throw ex;
     }
 }
开发者ID:raselahmmedgit,项目名称:simreg-sample,代码行数:17,代码来源:BOSIMREG_NEWFORM.cs

示例9: TotalDataCount

        public int TotalDataCount()
        {
            int totalRow = 0;

            try
            {
                sqlHelper = new SQLHelper();
                totalRow = daSIMREG_NEWFORM.TotalDataCount(sqlHelper);
                sqlHelper.CommitTran();
            }
            catch (Exception ex)
            {
                //SimReg.Common.Utility.SaveErrorLog(this.GetType().ToString(), "", ex);
                if (sqlHelper != null) sqlHelper.Rollback();
            }
            finally
            {
                sqlHelper = null;
            }

            return totalRow;
        }
开发者ID:raselahmmedgit,项目名称:simreg-sample,代码行数:22,代码来源:BOSIMREG_NEWFORM.cs

示例10: UpdateDatabase

 /// <summary>
 /// Updates a database (only adds new fields, tables, etc. does not delete old fields)
 /// </summary>
 /// <param name="DesiredDatabase">The desired structure of the database</param>
 /// <param name="CurrentDatabase">The current database structure</param>
 /// <param name="ConnectionString">Connection string to the database</param>
 public static void UpdateDatabase(Database DesiredDatabase, Database CurrentDatabase, string ConnectionString)
 {
     if (CurrentDatabase == null)
     {
         CreateDatabase(DesiredDatabase, ConnectionString);
         return;
     }
     string Command = BuildCommands(DesiredDatabase, CurrentDatabase);
     string[] Splitter = { "\n" };
     string[] Commands = Command.Split(Splitter, StringSplitOptions.RemoveEmptyEntries);
     ConnectionString = Regex.Replace(ConnectionString, "Pooling=(.*?;)", "", RegexOptions.IgnoreCase) + ";Pooling=false;";
     using (SQLHelper Helper = new SQLHelper("", ConnectionString, CommandType.Text))
     {
         try
         {
             Helper.BeginTransaction();
             for (int x = 0; x < Commands.Length; ++x)
             {
                 Helper.Command = Commands[x];
                 Helper.ExecuteNonQuery();
             }
             Helper.Commit();
         }
         catch { Helper.Rollback(); throw; }
     }
 }
开发者ID:yiwayhb,项目名称:Craig-s-Utility-Library,代码行数:32,代码来源:SQLServer.cs


注:本文中的SQLHelper.Rollback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。