本文整理汇总了C#中Estar.Business.DataManager.QueryDataRes.ExecuteNonQuery方法的典型用法代码示例。如果您正苦于以下问题:C# QueryDataRes.ExecuteNonQuery方法的具体用法?C# QueryDataRes.ExecuteNonQuery怎么用?C# QueryDataRes.ExecuteNonQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Estar.Business.DataManager.QueryDataRes
的用法示例。
在下文中一共展示了QueryDataRes.ExecuteNonQuery方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: executeTimer
/// <summary>
/// 定时执行业务
/// </summary>
/// <param name="obj"></param>
void executeTimer(object obj)
{
DateTime dt = DateTime.Today.AddDays(-1);
NameObjectList ps = new NameObjectList();
ps.Add("开始日期", dt);
ps.Add("结束日期", dt);
QueryDataRes query = new QueryDataRes("基础类");
DataTable tab = query.getTable("考勤人员列表", null);
if (null == tab || tab.Rows.Count < 1)
{
isTmRunning = false;
return;
}
NameValueCollection data = new NameValueCollection();
data["服务"] = "考勤作业";
DataColumnCollection cols = tab.Columns;
foreach (DataRow dr in tab.Rows)
{
foreach (DataColumn c in cols)
ps[c.ColumnName] = Convert.ToString(dr[c]);
try
{
bool b = query.ExecuteNonQuery("考勤人员列表", ps, ps, ps);
if (b) continue;
}
catch (Exception ex)
{
foreach (string key in ps.AllKeys)
data.Add(key, Convert.ToString(ps[key]));
LogMessage(ex, data, EventLogEntryType.Error);
continue;
}
foreach (string key in ps.AllKeys)
data.Add(key, Convert.ToString(ps[key]));
LogMessage("考勤作业失败!", data, EventLogEntryType.Warning);
}
isTmRunning = false;
}
示例2: Save
/// <summary>
/// 更新数据
/// </summary>
/// <param name="query">数据查询</param>
/// <param name="tab">数据表,更新的数据项是数据表名称</param>
/// <param name="ps">环境参数</param>
/// <returns>是否执行成功</returns>
public static bool Save(QueryDataRes query, DataTable tab, NameObjectList ps)
{
if (null == query || null == tab || tab.Rows.Count < 1)
return true;
NameObjectList[] psins = ParamManager.createParam(tab, DataRowState.Added);
NameObjectList[] psupt = ParamManager.createParam(tab, DataRowState.Modified);
NameObjectList[] psdel = ParamManager.createParam(tab, DataRowState.Deleted);
foreach (NameObjectList p in psins)
ParamManager.MergeParam(p, ps, false);
foreach (NameObjectList p in psupt)
ParamManager.MergeParam(p, ps, false);
foreach (NameObjectList p in psdel)
ParamManager.MergeParam(p, ps, false);
if (psins.Length < 1 && psupt.Length < 1 && psdel.Length < 1)
return true;
bool isSuccess = query.ExecuteNonQuery(tab.TableName, psins, psupt, psdel);
if (isSuccess)
tab.AcceptChanges();
return isSuccess;
}
示例3: ExecuteDataRows
/// <summary>
/// 对同一个target循环执行数据记录关联的指令,执行成功后执行sql更新
/// </summary>
/// <param name="drs">指令数据数组</param>
/// <param name="colmap">字段与指令的映射</param>
/// <param name="tpl">指令协议类别:停车场/消费/门禁/考勤/卡务中心</param>
/// <param name="cmd">指令命令名称</param>
/// <param name="target">通讯目标位置</param>
/// <param name="deviceID">设备下位机地址</param>
/// <param name="query">数据更新执行实例</param>
/// <param name="dbItem">执行更新的数据项</param>
/// <returns>成功执行返回空,失败返回错误原因</returns>
public static string ExecuteDataRows(DataRow[] drs, string[,] colmap, string tpl, string cmd, CommiTarget target, string deviceID, QueryDataRes query, string dbItem)
{
if (null == drs || drs.Length < 1 || null == colmap || colmap.GetLength(1) < 2 || string.IsNullOrEmpty(tpl) || string.IsNullOrEmpty(cmd))
return "";
if (null == target || string.IsNullOrEmpty(deviceID))
return "";
//声明一个集合来储存数据
List<DataRow> drList = new List<DataRow>();
string msg = "";
//执行指令
CmdProtocol cmdP = new CmdProtocol(deviceID, false);
//循环得到传过来的数据
foreach (DataRow dr in drs)
{
if (null == dr) continue;
string tagdata = "@设备地址=" + deviceID;
for (int c = 0; c < colmap.GetLength(0); c++)
{
object val = dr[colmap[c, 1]];
if (true.Equals(val)) val = "1";
if (false.Equals(val)) val = "0";
tagdata = basefun.setvaltag(tagdata, colmap[c, 0], Convert.ToString(val));
}
//设置指令
cmdP.setCommand(tpl, cmd, tagdata);
cmdP.ResetState();
//发送指令
CommiManager.GlobalManager.SendCommand(target, cmdP);
if (!cmdP.EventWh.WaitOne(2000, false))
{
msg = basefun.setvaltag(tagdata, "{状态}", "通讯超时失败!");
break;
}
if (string.IsNullOrEmpty(cmdP.ResponseFormat))
{
msg = basefun.setvaltag(tagdata, "{状态}", tagdata + "指令错误!");
break;
}
drList.Add(dr);
}
//更新数据库
//判断数据源和存储过程是否为空
if (null == query || string.IsNullOrEmpty(dbItem))
return msg;
//得到数据的数量
Estar.Common.Tools.NameObjectList[] ps = new Estar.Common.Tools.NameObjectList[drList.Count];
for (int i = 0; i < drList.Count; i++)
ps[i] = ParamManager.createParam(drList[i]);
//得到数据与配置的数据已经保持一致,但发现没有执行存储过程。。。
//执行数据库操作(方法封装在query内)
bool success = query.ExecuteNonQuery(dbItem, ps, ps, ps);
if (!success)
msg = basefun.setvaltag(msg, "{状态}", basefun.valtag(msg, "{状态}") + "更新数据库失败!");
return msg;
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
string strResult = "";
if (null == this.Session["userid"])
{
strResult = leofun.setvaltag("", "成功", "false");
strResult = leofun.setvaltag(strResult, "提示", "无效用户,请重新登录!");
this.Response.Write(leofun.Escape(strResult));
return;
}
//User userInfo = new User(this.Session["userid"].ToString());
XmlDocument xmldoc = new XmlDocument();
//读取用户参数
StreamReader streamreader = new StreamReader(this.Request.InputStream, Encoding.UTF8);
xmldoc.LoadXml(streamreader.ReadToEnd());
NameObjectList paramlist = BuildParamList.BuildParams(xmldoc);
string[] dataItems = BuildParamList.getValue(xmldoc, "workdataitems").Split(',');
string datasrcFile = BuildParamList.getValue(xmldoc, "DataSrcFile");
QueryDataRes query = new QueryDataRes(datasrcFile);
//QueryDataRes query = new QueryDataRes(unitItem.DataSrcFile);
try
{
query.BeginTransaction();
for (int i = 0; i < dataItems.Length; i++)
{
//WorkItem workItem = this.unitItem.WorkItemList[i];
//检测一
//强行置入ip地址做为参数
BuildParamList.setValue(xmldoc, "ip", HttpContext.Current.Request.UserHostAddress);
//NameObjectList[] paramInsList = this.CreateParamLists("new", xmldoc, paramlist, workItem);
NameObjectList[] paramInsList = this.CreateParamLists("new", xmldoc, paramlist, dataItems[i]);
NameObjectList[] paramUptList = this.CreateParamLists("modify", xmldoc, paramlist, dataItems[i]);
NameObjectList[] paramDelList = this.CreateParamLists("delete", xmldoc, paramlist, dataItems[i]);
bool bSuccess = query.ExecuteNonQuery(dataItems[i], paramInsList, paramUptList, paramDelList);
if (false == bSuccess)
throw (new Exception("保存项目失败:请检查配置和错误日志!"));
if ("系统数据源" == Path.GetFileName(datasrcFile).ToLower() && "系统信息配置" == dataItems[i])
{
this.ConfigSystem(paramInsList);
this.ConfigSystem(paramUptList);
}
}
query.Commit();
strResult = leofun.setvaltag("", "成功", "true");
strResult = leofun.setvaltag(strResult, "提示", "保存成功!");
this.Response.Write(leofun.Escape(strResult));
}
catch (Exception ex)
{
query.RollbackAndClose();
strResult = leofun.setvaltag("", "成功", "false");
strResult = leofun.setvaltag(strResult, "提示", ex.Message);
this.Response.Write(leofun.Escape(strResult));
}
finally
{
query.Close();
}
}
示例5: InitBtn_Click
/// <summary>
/// 初始化硬件设备
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void InitBtn_Click(object sender, EventArgs e)
{
int[] indexlist = this.getCheckedList();
if (indexlist.Length < 1)
{
MessageBox.Show("请选择一个设备", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (DialogResult.Yes != MessageBox.Show("初始化设备会清空设备存储的数据,是否确认需要初始化!", "设备初始化", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
return;
string strdevIDs = "", msg = "", strdevNames = "";
string tpl = "停车场", cmd = "格式化";
DataTable tab = this.dbGrid.DataSource as DataTable;
foreach (int i in indexlist)
{
DataRow dr = tab.Rows[i];
CommiTarget target = this.getTarget(dr);
CmdProtocol cmdP = new CmdProtocol(Convert.ToString(dr["名称"]), false);
string devid = Convert.ToString(dr["站址"]);
string tagdata = "@设备地址=" + devid;
cmdP.setCommand(tpl, cmd, tagdata);
CommiManager.GlobalManager.SendCommand(target, cmdP);
if (!cmdP.EventWh.WaitOne(2000, false))
msg = cmdP.CmdId + ":通讯失败,请检查设备连接或通讯参数后重试!";
string rpmsg = basefun.valtag(cmdP.ResponseFormat, "{状态}");
if (string.IsNullOrEmpty(msg) && !string.IsNullOrEmpty(rpmsg) && "操作成功!" != rpmsg)
msg = cmdP.CmdId + ":" + rpmsg;
if (!string.IsNullOrEmpty(msg))
break;
strdevIDs += "," + devid;
strdevNames += cmdP.CmdId + ",";
}
//形成参数
string[] devids = strdevIDs.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
NameObjectList[] psList = new NameObjectList[devids.Length];
for (int i = 0; i < devids.Length; i++)
{
psList[i] = new NameObjectList();
psList[i]["devID"] = devids[i];
}
QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile);
if (psList.Length > 0)
query.ExecuteNonQuery("删除设备白名单", psList, psList, psList);
if (string.IsNullOrEmpty(msg))
MessageBox.Show("设备初始化成功!", "设备初始化", MessageBoxButtons.OK, MessageBoxIcon.Information);
else
{
msg = string.IsNullOrEmpty(strdevNames) ? msg : strdevNames + "成功执行初始化,\r\n" + msg;
MessageBox.Show(msg, "设备初始化", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
示例6: tbOK_Click
/// <summary>
/// 确定交班
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tbOK_Click(object sender, EventArgs e)
{
bool isNotExist = false;
string user = Convert.ToString(this.ccbNextUser.Text);
string pws = this.tbPassword.Text;
if (string.IsNullOrEmpty(user) || string.IsNullOrEmpty(pws))
{
MessageBox.Show("请选择接班人和输入接班人密码!", "接班提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
this.paramwin["交班人"] = BindManager.getUser().UserAccounts;
this.paramwin["密码"] = pws;
User user1 = new User(user, ref isNotExist);
if (!isNotExist)
isNotExist = !user1.login(tbUserName.Text, pws);
if (isNotExist)
{
MessageBox.Show("密码不正确!", "系统提示");
return;
}
QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile);
this.paramwin["操作员"] = BindManager.getUser().UserName;
this.paramwin["值班人"] = ccbNextUser.Text;
IPHostEntry IpEntry = Dns.GetHostEntry(Dns.GetHostName());
string myip = IpEntry.AddressList[0].ToString();
this.paramwin["电脑IP"] = myip;
bool isSuccess = query.ExecuteNonQuery("交接班", this.paramwin, this.paramwin, this.paramwin);
if (!isSuccess)
{
MessageBox.Show("执行交接班时失败请与管理员联系!", "接班提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
BindManager.setUser(user);
string operName = this.ccbNextUser.Text.Trim();
string workStartTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
string ip = this.paramwin.AllValues.GetValue(2).ToString();
string tag = string.Empty;
tag = basefun.setvaltag(tag, "值班人", operName);
tag = basefun.setvaltag(tag, "接班时间", workStartTime);
tag = basefun.setvaltag(tag, "电脑IP", ip);
NameObjectList ps = ParamManager.createParam(tag);
ParamManager.MergeParam(ps, this.paramwin, false);
query.ExecuteNonQuery("当班状态", ps, ps, ps);
MessageBox.Show("已经成功执行交接班!\r\n" + this.ccbNextUser.Text + " 开始工作!", "接班提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.DialogResult = DialogResult.Yes;
this.Close();
}
示例7: btnReset_Click
/// <summary>
/// ��������
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnReset_Click(object sender, EventArgs e)
{
if (this.dbUserView.RowCount < 1)
return;
DataRow dr = this.dbUserView.GetDataRow(this.dbUserView.FocusedRowHandle);
NameObjectList ps = ParamManager.createParam(dr);
QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile);
if (!query.ExecuteNonQuery("�û������ʼ��", ps, ps, ps))
MessageBox.Show("��������ʧ�ܣ�", "��������", MessageBoxButtons.OK, MessageBoxIcon.Warning);
else
MessageBox.Show("�ɹ���������Ϊ��abc123\r\n�뼰ʱ������ȷ����ȫ", "��������", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
示例8: simpleButton4_Click
/// <summary>
/// ��ʧ
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void simpleButton4_Click(object sender, EventArgs e)
{
getNewDataByCardNo(txtCardRealNo.Text);
if (string.IsNullOrEmpty(txtCardRealNo.Text))
{
XtraMessageBox.Show("�������", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (dsUnit.Tables["selectCard"].Rows.Count < 1)
{
XtraMessageBox.Show("�˿�δ���У�", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (status == "�˿�")
{
XtraMessageBox.Show("�˿���״̬Ϊ�˿������ܹ�ʧ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
IPHostEntry IpEntry = Dns.GetHostEntry(Dns.GetHostName());
string myip = IpEntry.AddressList[0].ToString();
NameObjectList ps = this.buildParam(this, null);
ps["�豸"] = DevIdS;
ps["LocalIP"] = myip;
ps["Localhost"] = System.Net.Dns.GetHostName();
ps["UserAccounts"] = BindManager.getUser().UserName;
QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile);
NameObjectList psnull = new NameObjectList();
if (query.ExecuteNonQuery("��ʧ", ps, ps, psnull))
XtraMessageBox.Show("��ʧ�ɹ�", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
else XtraMessageBox.Show("��ʧʧ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//ˢ�¼�¼
this.dsUnit.Tables["�û�ѡ��"].Clear();
this.Query.FillDataSet("�û�ѡ��", new NameObjectList(), this.dsUnit);
this.dsUnit.Tables["��־"].Clear();
this.Query.FillDataSet("��־", new NameObjectList(), this.dsUnit);
}
示例9: btnCardQuit_Click
/// <summary>
/// �˿�
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnCardQuit_Click(object sender, EventArgs e)
{
getNewDataByCardNo(cardno);
if (string.IsNullOrEmpty(cardno))
{
XtraMessageBox.Show("�������", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (dsUnit.Tables["selectCard"].Rows.Count < 1)
{
XtraMessageBox.Show("�˿�δ���У�", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (status == "��ʧ")
{
XtraMessageBox.Show("�˿���״̬Ϊ��ʧ�������˿���", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
#region Ic����������˿�
if (radic.Checked)
{
string CardStatus = "";
//����
if (Etime.Enabled)
{
CardStatus = cmdCard.ClearData(CardArea.Eatery);
CardStatus = basefun.valtag(CardStatus, "{״̬}");
if (CardStatus != "�����ɹ���")
{
MessageBox.Show(CardStatus, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
//ͣ����
if (Ptime.Enabled)
{
CardStatus = cmdCard.ClearData(CardArea.Park);
CardStatus = basefun.valtag(CardStatus, "{״̬}");
if (CardStatus != "�����ɹ���")
{
MessageBox.Show(CardStatus, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
//������ʾ
cmdCard.Buzz(true);
}
#endregion
IPHostEntry IpEntry = Dns.GetHostEntry(Dns.GetHostName());
string myip = IpEntry.AddressList[0].ToString();
NameObjectList ps = this.buildParam(this, null);
if (this.radYou.Checked)
{
ps["�Ƿ��п�"] = 0;
}
else if (this.radWu.Checked)
{
ps["�Ƿ��п�"] = 1;
}
ps["UserAccounts"] = BindManager.getUser().UserName;
ps["�豸"] = DevIdS;
ps["LocalIP"] = myip;
ps["Localhost"] = System.Net.Dns.GetHostName();
QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile);
NameObjectList psnull = new NameObjectList();
if (query.ExecuteNonQuery("�˿�", ps, ps, ps))
XtraMessageBox.Show("�˿��ɹ�", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
else XtraMessageBox.Show("�˿�ʧ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//ˢ�¼�¼
this.dsUnit.Tables["�û�ѡ��"].Clear();
this.Query.FillDataSet("�û�ѡ��", new NameObjectList(), this.dsUnit);
this.dsUnit.Tables["��־"].Clear();
this.Query.FillDataSet("��־", new NameObjectList(), this.dsUnit);
}
示例10: btnCardPay_Click
/// <summary>
/// ��ֵ����
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnCardPay_Click(object sender, EventArgs e)
{
getNewDataByCardNo(txtCardRealNo.Text);
if (string.IsNullOrEmpty(txtCardRealNo.Text))
{
XtraMessageBox.Show("�������", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (dsUnit.Tables["selectCard"].Rows.Count < 1)
{
XtraMessageBox.Show("�˿�δ���У�", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (status == "�˿�")
{
XtraMessageBox.Show("�˿���״̬Ϊ�˿������ܳ�ֵ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (status == "��ʧ")
{
XtraMessageBox.Show("�˿���״̬Ϊ��ʧ�����ܳ�ֵ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (radic.Checked)
{
if (WriteInfo("��ֵ") == false) return;
}
IPHostEntry IpEntry = Dns.GetHostEntry(Dns.GetHostName());
string myip = IpEntry.AddressList[0].ToString();
NameObjectList ps = this.buildParam(this, null);
if (this.radYou.Checked)
{
ps["�Ƿ��п�"] = 0;
}
else if (this.radWu.Checked)
{
ps["�Ƿ��п�"] = 1;
}
if (!this.Etime.Enabled) ps["����"] = ""; else ps["����"] = "����";
if (!this.Dtime.Enabled) ps["�Ž�"] = ""; else ps["�Ž�"] = "�Ž�";
if (!this.Ptime.Enabled) ps["ͣ����"] = ""; else ps["ͣ����"] = "ͣ����";
if (dtime1 == DateTime.Now.ToString("yyyy-MM-dd")) dtime1 = this.txtdtime.Text;
if (etime1 == DateTime.Now.ToString("yyyy-MM-dd")) etime1 = this.txtEtime.Text;
if (ptime1 == DateTime.Now.ToString("yyyy-MM-dd")) ptime1 = this.txtptime.Text;
if (string.IsNullOrEmpty(dtime1)) dtime1 = DateTime.Now.ToString("yyyy-MM-dd");
if (string.IsNullOrEmpty(etime1)) etime1 = DateTime.Now.ToString("yyyy-MM-dd");
if (string.IsNullOrEmpty(ptime1)) ptime1 = DateTime.Now.ToString("yyyy-MM-dd");
ps["�Ž�����"] = dtime1;
ps["��������"] = etime1;
ps["ͣ��������"] = ptime1;
ps["�ֽ��ֵ"] = txtXJmoney.Text;
ps["������ֵ"] = txtBZmoney.Text;
ps["�����ۼ�"] = IsaddBZMoney;
ps["UserAccounts"] = BindManager.getUser().UserName;
ps["�豸"] = DevIdS;
ps["LocalIP"] = myip;
ps["Localhost"] = System.Net.Dns.GetHostName();
QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile);
NameObjectList psnull = new NameObjectList();
if (query.ExecuteNonQuery("��ֵ", ps, ps, ps))
XtraMessageBox.Show("��ֵ�ɹ�", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
else XtraMessageBox.Show("��ֵʧ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//ˢ�¼�¼
this.dsUnit.Tables["�û�ѡ��"].Clear();
this.Query.FillDataSet("�û�ѡ��", new NameObjectList(), this.dsUnit);
this.dsUnit.Tables["��־"].Clear();
this.Query.FillDataSet("��־", new NameObjectList(), this.dsUnit);
getNewDataByCardNo(txtCardRealNo.Text);
}