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


C# DbHelper.ExecuteNonQuery方法代码示例

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


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

示例1: CreateProcedure

 /// summary
 /// �������ݿ�洢����
 /// /summary
 /// param name="procedureName"�洢������/param
 /// param name="procedureText"�洢��������/param
 public override void CreateProcedure(string procedureName, string procedureText)
 {
     if(procedureText != null && procedureText.Trim() != "")
     {
         DropProcedure(procedureName);
         DbHelper helper = new DbHelper();
         helper.ExecuteNonQuery(procedureText);
     }
 }
开发者ID:jokingzhou,项目名称:AnJi-DevZoneGIS,代码行数:14,代码来源:DbUtil.cs

示例2: CreateFunction

 /// summary
 /// �������ݿ⺯��
 /// /summary
 /// param name="functionName"������/param
 /// param name="functionText"��������/param
 public override void CreateFunction(string functionName, string functionText)
 {
     if(functionText != null && functionText.Trim() != "")
     {
         DropFunction(functionName);
         DbHelper helper = new DbHelper();
         helper.ExecuteNonQuery(functionText);
     }
 }
开发者ID:jokingzhou,项目名称:AnJi-DevZoneGIS,代码行数:14,代码来源:DbUtil.cs

示例3: Insert

        public bool Insert(User tModel) {
            using (SqlCommand command = new DbHelper().Command) {
                command.CommandText =
                    "insert into eduuser(userid,userpass,name,age,birthday) values (@userid,@userpass,@name,@age,@birthday)";
                command.Parameters.AddRange(CreateSqlParameters(tModel));
                int ret = command.ExecuteNonQuery();

                return ret > 0;
            }
        }
开发者ID:kangwl,项目名称:DotNet.Mix,代码行数:10,代码来源:UserDal.cs

示例4: Insert

        public bool Insert(User_Model tModel) {
            using (SqlCommand command = new DbHelper().Command) {
                command.CommandText =
                    $"insert into {Table}(UserID,[Password],Name,Sex,Birthday,Email) values (@UserID,@Password,@Name,@Sex,@Birthday,@Email)";
                command.Parameters.AddRange(CreateSqlParameters(tModel));
                int ret = command.ExecuteNonQuery();

                return ret > 0;
            }
        }
开发者ID:kangwl,项目名称:DotNet.Mix,代码行数:10,代码来源:User_Dal.cs

示例5: InsertBatch

        public int InsertBatch(List<User> tModels, bool tran = false) {
            using (SqlCommand command = new DbHelper().Command) {

                try {
                    if (tran) {
                        command.Transaction = command.Connection.BeginTransaction();
                    }
                    int ret = 0;
                    foreach (User tModel in tModels) {
                        command.CommandText =
                            "insert into eduuser(userid,userpass,name,age,birthday) values (@userid,@userpass,@name,@age,@birthday)";
                        command.Parameters.Clear();
                        command.Parameters.AddRange(CreateSqlParameters(tModel));
                        ret += command.ExecuteNonQuery();
                    }
                    if (tran) {
                        command.Transaction.Commit();
                    }
                    return ret;
                }
                catch (Exception ex) {
                    if (tran) {
                        command.Transaction.Rollback();
                    }
                    XK.Common.Log4net.Error(ex);
                    return 0;
                }
            }
        }
开发者ID:kangwl,项目名称:DotNet.Mix,代码行数:29,代码来源:UserDal.cs

示例6: CreateView

 /// summary
 /// �������ݿ���ͼ
 /// /summary
 /// param name="viewName"��ͼ��/param
 /// param name="viewText"��ͼ����/param
 public override void CreateView(string viewName, string viewText)
 {
     if(viewText != null && viewText.Trim() != "")
     {
         DropView(viewName);
         DbHelper helper = new DbHelper();
         helper.ExecuteNonQuery(viewText);
     }
 }
开发者ID:jokingzhou,项目名称:AnJi-DevZoneGIS,代码行数:14,代码来源:DbUtil.cs

示例7: EnableTrigger

 /// summary
 /// Enable������
 /// /summary
 /// param name="triggerName"����������/param
 /// param name="tableName"���������ڱ���/param
 public override void EnableTrigger(string triggerName,string tableName)
 {
     string commandText = string.Format("alter table {0} enable trigger {1}",tableName,triggerName);
     DbHelper helper = new DbHelper();
     helper.ExecuteNonQuery(commandText);
 }
开发者ID:jokingzhou,项目名称:AnJi-DevZoneGIS,代码行数:11,代码来源:DbUtil.cs

示例8: EnablePKConstraint

 /// summary
 /// Enable����
 /// /summary
 /// param name="pkTableName"������/param
 /// param name="pkConstraint"����/param
 /// param name="pkField"�����ֶ�/param
 public override void EnablePKConstraint(string pkTableName,string pkConstraint,string pkField)
 {
     string commandText = string.Format("alter table {0} enable constraint {1}",
         pkTableName,pkConstraint);
     DbHelper helper = new DbHelper();
     helper.ExecuteNonQuery(commandText);
 }
开发者ID:jokingzhou,项目名称:AnJi-DevZoneGIS,代码行数:13,代码来源:DbUtil.cs

示例9: DisableFKConstraint

 /// summary
 /// Disable���
 /// /summary
 /// param name="fkTableName"�����/param
 /// param name="fkConstraint"���/param
 public override void DisableFKConstraint(string fkTableName,string fkConstraint)
 {
     string commandText = string.Format("alter table {0} disable constraint {1}",
         fkTableName,fkConstraint);
     DbHelper helper = new DbHelper();
     helper.ExecuteNonQuery(commandText);
 }
开发者ID:jokingzhou,项目名称:AnJi-DevZoneGIS,代码行数:12,代码来源:DbUtil.cs

示例10: InsertBatch

        public int InsertBatch(List<User_Model> tModels, bool tran = false) {
            using (SqlCommand command = new DbHelper().Command) {

                try {
                    if (tran) {
                        command.Transaction = command.Connection.BeginTransaction();
                    }
                    int ret = 0;
                    foreach (User_Model tModel in tModels) {
                        command.CommandText =
                            $"insert into {Table}(UserID,[Password],Name,Sex,Birthday,Email) values (@UserID,@Password,@Name,@Sex,@Birthday,@Email)";
                        command.Parameters.Clear();
                        command.Parameters.AddRange(CreateSqlParameters(tModel));
                        ret += command.ExecuteNonQuery();
                    }
                    if (tran) {
                        command.Transaction.Commit();
                    }
                    return ret;
                }
                catch (Exception ex) {
                    if (tran) {
                        command.Transaction.Rollback();
                    }
                    XK.Common.Log4net.Error(ex);
                    return 0;
                }
            }
        }
开发者ID:kangwl,项目名称:DotNet.Mix,代码行数:29,代码来源:User_Dal.cs

示例11: EnsureSessionUserConsistence

        public void EnsureSessionUserConsistence()
        {
            DbHelper dbHelper = new DbHelper();
            DbCommand comannd = dbHelper.BuildDbCommand("P_IC_SESSIONS_CHECK_USER_NAME");
            dbHelper.AssignParameterValues(comannd, AppContext.Current.SessionID, AppContext.Current.UserName);
            dbHelper.ExecuteNonQuery(comannd);
            bool isKilled = (bool)dbHelper.GetParameterValue(comannd, "p_is_killed");
            bool userSessionMatched = (bool)dbHelper.GetParameterValue(comannd, "p_user_session_matched");

            if (isKilled)
            {
                throw new SessionRenewException(Messages.Framework.FWE003.Format(), SessionStatus.Killed);
            }

            if (!userSessionMatched)
            {

                throw new SessionRenewException(Messages.Framework.FWE006.Format(), SessionStatus.NotMatchUserName);
            }
        }
开发者ID:rentianhua,项目名称:AgileMVC,代码行数:20,代码来源:SessionRenewDA.cs


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