本文整理汇总了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;
}
示例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;
}
示例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;
});
}
示例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;
});
}
示例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;
}
示例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;
});
}
示例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());
});
}
示例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;
});
}
示例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;
});
}
示例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());
});
}
示例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;
});
}
示例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;
}
示例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());
});
}
示例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());
});
}
示例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;
});
}