當前位置: 首頁>>代碼示例>>C#>>正文


C# DbConn.ExecuteSql方法代碼示例

本文整理匯總了C#中XXF.Db.DbConn.ExecuteSql方法的典型用法代碼示例。如果您正苦於以下問題:C# DbConn.ExecuteSql方法的具體用法?C# DbConn.ExecuteSql怎麽用?C# DbConn.ExecuteSql使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XXF.Db.DbConn的用法示例。


在下文中一共展示了DbConn.ExecuteSql方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Add

        /// <summary>
        /// createtime expiresetime不用傳。
        /// </summary>
        /// <param name="PubConn"></param>
        /// <param name="model"></param>
        /// <param name="tokentype"></param>
        /// <returns></returns>
        public virtual bool Add(DbConn PubConn, DbModels.tb_token model, Models.DbModels.TokenType tokentype)
        {
            DateTime nowtime = PubConn.GetServerDate();
            model.createtime = nowtime;
            model.expires = nowtime.AddMinutes(GetExpiresminutes(tokentype));
            List<ProcedureParameter> Par = new List<ProcedureParameter>()
                {

                    //
                    new ProcedureParameter("@token",    model.token),
                    //
                    new ProcedureParameter("@userid",    model.userid),
                    new ProcedureParameter("@id",    model.id),
                    //
                    new ProcedureParameter("@username",    model.username),
                    //
                    new ProcedureParameter("@appid",    model.appid),
                    //
                    new ProcedureParameter("@createtime",   model.createtime),
                    //
                    new ProcedureParameter("@expires", model.expires  )
                };
            int rev = PubConn.ExecuteSql("insert into " + tokentype.ToString() + " (token,userid,id,username,appid,createtime,expires)" +
                                         "  values(@token,@userid,@id,@username,@appid,@createtime,@expires)", Par);
            return rev == 1;
        }
開發者ID:buweixiaomi,項目名稱:DydCert,代碼行數:33,代碼來源:TokenDal.cs

示例2: Add

        public virtual bool Add(DbConn PubConn, tb_user_model model)
        {

            List<ProcedureParameter> Par = new List<ProcedureParameter>()
                {
					
					//員工工號
					new ProcedureParameter("@userstaffno",    model.userstaffno),
					//
					new ProcedureParameter("@username",    model.username),
					//員工角色,查看代碼枚舉:開發人員,管理員
					new ProcedureParameter("@userrole",    model.userrole),
					//
					new ProcedureParameter("@usercreatetime",    model.usercreatetime),
					//員工手機號碼
					new ProcedureParameter("@usertel",    model.usertel),
					//
					new ProcedureParameter("@useremail",    model.useremail),
					//登錄密碼
					new ProcedureParameter("@userpsw",    model.userpsw)  
                };
            int rev = PubConn.ExecuteSql(@"insert into tb_user(userstaffno,username,userrole,usercreatetime,usertel,useremail,userpsw)
										   values(@userstaffno,@username,@userrole,@usercreatetime,@usertel,@useremail,@userpsw)", Par);
            return rev == 1;

        }
開發者ID:houzhenggang,項目名稱:Dyd.BaseService.TaskManager,代碼行數:26,代碼來源:tb_user_dal.cs

示例3: Add2

        public virtual bool Add2(DbConn PubConn, tb_producter_model model)
        {
            return SqlHelper.Visit((ps) =>
            {
                List<ProcedureParameter> Par = new List<ProcedureParameter>()
                {

                    //��������ʱid(�����������Ψһ,Guidתlong)
                    new ProcedureParameter("@tempid",    model.tempid),
                    //����������
                    new ProcedureParameter("@productername",    model.productername),
                    //ip��ַ
                    new ProcedureParameter("@ip",    model.ip),
                    //����id
                    new ProcedureParameter("@mqpathid",    model.mqpathid),
                    ////�������������ʱ��
                    //new ProcedureParameter("@lastheartbeat",    model.lastheartbeat),
                    ////�����ߴ���ʱ��
                    //new ProcedureParameter("@createtime",    model.createtime)
                };
                int rev = PubConn.ExecuteSql(@"insert into tb_producter(tempid,productername,ip,mqpathid,lastheartbeat,createtime)
                                           values(@tempid,@productername,@ip,@mqpathid,getdate(),getdate())", Par);
                return rev == 1;
            });
        }
開發者ID:xwx2015,項目名稱:MQ,代碼行數:25,代碼來源:tb_producter_dal.cs

示例4: Add2

        public virtual bool Add2(DbConn PubConn, tb_consumer_model model)
        {
            return SqlHelper.Visit((ps) =>
            {
                List<ProcedureParameter> Par = new List<ProcedureParameter>()
                    {

                        //��������ʱid(�����������Ψһ,Guidתlong)
                        new ProcedureParameter("@tempid",    model.tempid),
                        //������clinet��id
                        new ProcedureParameter("@consumerclientid",    model.consumerclientid),
                        //֧�ֵķ���˳���(֧�ֶ��˳���)
                        new ProcedureParameter("@partitionindexs",    model.partitionindexs),
                        //�ͻ�������
                        new ProcedureParameter("@clientname",    model.clientname),
                        ////�������ʱ��(�Ե�ǰ��ʱ��Ϊ׼)
                        //new ProcedureParameter("@lastheartbeat",    model.lastheartbeat),
                        ////��һ�θ���ʱ��(�Ե�ǰ��ʱ��Ϊ׼)
                        //new ProcedureParameter("@lastupdatetime",    model.lastupdatetime),
                        ////�ͻ��˴���ʱ��(�Ե�ǰ��ʱ��Ϊ׼)
                        //new ProcedureParameter("@createtime",    model.createtime)
                    };
                int rev = PubConn.ExecuteSql(@"insert into tb_consumer(tempid,consumerclientid,partitionindexs,clientname,lastheartbeat,lastupdatetime,createtime)
                                               values(@tempid,@consumerclientid,@partitionindexs,@clientname,getdate(),getdate(),getdate())", Par);
                return rev == 1;
            });
        }
開發者ID:xwx2015,項目名稱:MQ,代碼行數:27,代碼來源:tb_consumer_dal.cs

示例5: Edit

        public virtual bool Edit(DbConn PubConn, tb_user_model model)
        {
            List<ProcedureParameter> Par = new List<ProcedureParameter>()
            {
                    
					//員工工號
					new ProcedureParameter("@userstaffno",    model.userstaffno),
					//
					new ProcedureParameter("@username",    model.username),
					//員工角色,查看代碼枚舉:開發人員,管理員
					new ProcedureParameter("@userrole",    model.userrole),
					//
					new ProcedureParameter("@usercreatetime",    model.usercreatetime),
					//員工手機號碼
					new ProcedureParameter("@usertel",    model.usertel),
					//
					new ProcedureParameter("@useremail",    model.useremail),
                    //登錄密碼
					new ProcedureParameter("@userpsw",    model.userpsw) 
            };
            Par.Add(new ProcedureParameter("@id", model.id));

            int rev = PubConn.ExecuteSql("update tb_user set [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected] where [email protected]", Par);
            return rev == 1;

        }
開發者ID:houzhenggang,項目名稱:Dyd.BaseService.TaskManager,代碼行數:26,代碼來源:tb_user_dal.cs

示例6: DeleteAll

 public void DeleteAll(DbConn PubConn)
 {
     SqlHelper.Visit((ps) =>
     {
         string Sql = "truncate table tb_error";
         int rev = PubConn.ExecuteSql(Sql, ps.ToParameters());
         return rev;
     });
 }
開發者ID:xwx2015,項目名稱:MQ,代碼行數:9,代碼來源:tb_error_dal.cs

示例7: UpdateTaskSuccess

 public int UpdateTaskSuccess(DbConn PubConn, int id)
 {
     return SqlHelper.Visit(ps =>
     {
         string cmd = "update tb_task set taskerrorcount=0,taskruncount=taskruncount+1 where [email protected]";
         ps.Add("id", id);
         return PubConn.ExecuteSql(cmd, ps.ToParameters());
     });
 }
開發者ID:houzhenggang,項目名稱:Dyd.BaseService.TaskManager,代碼行數:9,代碼來源:tb_task_dal.cs

示例8: DeleteOneNode

 public bool DeleteOneNode(DbConn PubConn, int id)
 {
     return SqlHelper.Visit<bool>(ps =>
     {
         ps.Add("id", id);
         string sql = "delete from tb_user where (select count(1) from tb_task where [email protected])=0 and [email protected]";
         int i = PubConn.ExecuteSql(sql, ps.ToParameters());
         return i > 0;
     });
 }
開發者ID:houzhenggang,項目名稱:Dyd.BaseService.TaskManager,代碼行數:10,代碼來源:tb_user_dal.cs

示例9: DeleteNotOnLineByClientID

 public bool DeleteNotOnLineByClientID(DbConn PubConn, int consumerclientid, int maxtimeoutsenconds)
 {
     return SqlHelper.Visit((ps) =>
     {
         ps.Add("@consumerclientid", consumerclientid); ps.Add("@maxtimeoutsenconds", maxtimeoutsenconds);
         string Sql = "delete from tb_consumer where [email protected] and DATEDIFF(S,lastheartbeat,getdate())>@maxtimeoutsenconds";
         int rev = PubConn.ExecuteSql(Sql, ps.ToParameters());
         return true;
     });
 }
開發者ID:xwx2015,項目名稱:MQ,代碼行數:10,代碼來源:tb_consumer_dal.cs

示例10: UpdateTaskError

 public int UpdateTaskError(DbConn PubConn, int id, DateTime time)
 {
     return SqlHelper.Visit(ps =>
     {
         string cmd = "update tb_task set taskerrorcount=taskerrorcount+1,[email protected] where [email protected]";
         ps.Add("id", id);
         ps.Add("tasklasterrortime", time);
         return PubConn.ExecuteSql(cmd, ps.ToParameters());
     });
 }
開發者ID:houzhenggang,項目名稱:Dyd.BaseService.TaskManager,代碼行數:10,代碼來源:tb_task_dal.cs

示例11: ClientHeatbeat

 public bool ClientHeatbeat(DbConn PubConn, int mqpathid, long tempid)
 {
     return SqlHelper.Visit((ps) =>
     {
         ps.Add("@mqpathid", mqpathid); ps.Add("@tempid", tempid);
         string Sql = "update tb_producter WITH (ROWLOCK) set lastheartbeat=getdate() where [email protected] and [email protected]";
         int rev = PubConn.ExecuteSql(Sql, ps.ToParameters());
         return true;
     });
 }
開發者ID:xwx2015,項目名稱:MQ,代碼行數:10,代碼來源:tb_producter_dal.cs

示例12: Update

        public bool Update(DbConn PubConn, tb_category_model model)
        {
            List<ProcedureParameter> Par = new List<ProcedureParameter>()
                {
					new ProcedureParameter("@categoryname",    model.categoryname),
                    new ProcedureParameter("@id",    model.id),
                };
            int rev = PubConn.ExecuteSql(@"update tb_category set [email protected] where [email protected]", Par);
            return rev == 1;
        }
開發者ID:houzhenggang,項目名稱:Dyd.BaseService.TaskManager,代碼行數:10,代碼來源:tb_category_dal.cs

示例13: UpdateLastStartTime

 public int UpdateLastStartTime(DbConn PubConn, int id, DateTime time)
 {
     return SqlHelper.Visit(ps =>
     {
         string cmd = "update tb_task set [email protected] where [email protected]";
         ps.Add("id", id);
         ps.Add("tasklaststarttime", time);
         return PubConn.ExecuteSql(cmd, ps.ToParameters());
     });
 }
開發者ID:houzhenggang,項目名稱:Dyd.BaseService.TaskManager,代碼行數:10,代碼來源:tb_task_dal.cs

示例14: SaveTempData

 public virtual int SaveTempData(DbConn PubConn,int taskid,string json)
 {
     return SqlHelper.Visit(ps =>
     {
         string cmd = "update tb_tempdata set [email protected] where [email protected]";
         ps.Add("taskid", taskid);
         ps.Add("tempdatajson",json);
         return PubConn.ExecuteSql(cmd, ps.ToParameters());
     });
 }
開發者ID:zeus911,項目名稱:Dyd.BaseService.TaskManager,代碼行數:10,代碼來源:tb_tempdata_dal.cs

示例15: Add2

 public virtual void Add2(DbConn PubConn, string client)
 {
     SqlHelper.Visit((ps) =>
     {
         ps.Add("@client", client);
         PubConn.ExecuteSql(@"insert into tb_consumer_client(client,createtime)
                                 values(@client,getdate())", ps.ToParameters());
         return true;
     });
 }
開發者ID:xwx2015,項目名稱:MQ,代碼行數:10,代碼來源:tb_consumer_client_dal.cs


注:本文中的XXF.Db.DbConn.ExecuteSql方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。