本文整理汇总了C#中AccessHelper.ExecuteSQLNonquery方法的典型用法代码示例。如果您正苦于以下问题:C# AccessHelper.ExecuteSQLNonquery方法的具体用法?C# AccessHelper.ExecuteSQLNonquery怎么用?C# AccessHelper.ExecuteSQLNonquery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AccessHelper
的用法示例。
在下文中一共展示了AccessHelper.ExecuteSQLNonquery方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: tbSave_Click
private void tbSave_Click(object sender, EventArgs e)
{
//检查数据格式
if(CheckMsg())
{
AccessHelper ah = new AccessHelper();
string sql = string.Empty;
if(XZQHID==0)//新增
{
sql = "insert into QuHua(行政区编码,行政区名称,父级编码) values('"+tbQHBM.Text.Trim()+"',";
sql+="'"+tbQHMC.Text.Trim()+"','"+FJQHBM+"')";
}
else
{
sql = "update QuHua set 行政区编码='"+tbQHBM.Text.Trim()+"',行政区名称='"+tbQHMC.Text.Trim()+"',父级编码='"+FJQHBM+"' where ID="+XZQHID;
}
if(ah.ExecuteSQLNonquery(sql))
{
this.DialogResult = DialogResult.OK;
string OtherSql = "update QuHua set 父级编码='" + tbQHBM.Text.Trim() + "' where 父级编码='"+oldQHBM+"'";
ah.ExecuteSQLNonquery(OtherSql);
MessageBox.Show("保存成功");
this.Close();
}
else
{
MessageBox.Show("保存失败");
}
ah.Close();
}
FJQHBM = string.Empty;
}
示例2: tbEdit_Click
private void tbEdit_Click(object sender, EventArgs e)
{
AccessHelper ah = new AccessHelper();
string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbOldPwd.Text, "MD5");
string sql = "select * from UserTable where uName='" + tbUserName.Text + "' and uPwd='" + pwd + "'";
DataTable dt = ah.SelectToDataTable(sql);
if (dt.Rows.Count == 0)
{
MessageBox.Show("用户名或密码错误!");
return;
}
if(tbNewPwd.Text.Length<6)
{
MessageBox.Show("请输入长度大于等于6位的密码!");
return;
}
if (!tbNewPwd.Text.Trim().Equals(tbRePwd.Text.Trim()))
{
MessageBox.Show("两次输入密码不一致!");
return;
}
string editPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbNewPwd.Text, "MD5");
string editSql = "update UserTable set uName='"+tbUserName.Text.Trim()+"',uPwd='"+editPwd+"' where id=" + dt.Rows[0]["id"].ToString();
if(ah.ExecuteSQLNonquery(editSql))
{
this.DialogResult = DialogResult.OK;
}
else
{
MessageBox.Show("修改失败!");
}
}
示例3: btnSave_Click
/// <summary>
/// 保存编辑的目录
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSave_Click(object sender, EventArgs e)
{
AccessHelper ah = new AccessHelper();
string sql = string.Empty;
if (CheckMsg())
{
if(MLID==0)//新增
{
if(ExistSameMuLu(tbCGML.Text.Trim()))
{
MessageBox.Show("包含相同目录的记录,请检查后录入");
return;
}
sql = "insert into Mulu(目录名称,检查级别) values('"+tbCGML.Text.Trim()+"',";
sql+="'"+"省级质检"+"')";//后期修改
}
else//修改
{
sql = "update Mulu set 目录名称='"+tbCGML.Text.Trim()+"',";
sql+="检查级别='"+"省级质检"+"' where ID=" + MLID;//后期修改
}
if(ah.ExecuteSQLNonquery(sql))
{
this.DialogResult = DialogResult.OK;
MessageBox.Show("保存成功");
this.Close();
}
else
{
MessageBox.Show("保存失败");
}
ah.Close();
}
}
示例4: btnSave_Click
private void btnSave_Click(object sender, EventArgs e)
{
if(CheckMsg())
{
AccessHelper ah = new AccessHelper();
string sql = string.Empty;
//新增
if(CGWJID==0)
{
if (!ExistSameWenJian(cbAction.Text.Trim(), tbEnd.Text.Trim()))
{
sql = "insert into WenJian(文件开始字符,文件结束字符,文件扩展名,文件类型,是否必填) values(";
sql += "'" + cbAction.SelectedText + "',";
sql += "'" + tbEnd.Text.Trim() + "',";
sql += "'" + lbWJKZM.Text + "',";
sql += "'" + tbType.Text.Trim() + "',";
sql += "" + (rbYes.Checked ? 1 : 0) + ")";
}
else
{
MessageBox.Show("包含相同开始字符和结束字符的数据");
return;
}
}
else//修改
{
sql = "update WenJian set 文件开始字符='" + cbAction.Text + "',";
sql += "文件结束字符='" + tbEnd.Text.Trim() + "',";
sql += "文件扩展名='" + lbWJKZM.Text + "',";
sql += "文件类型='" + tbType.Text.Trim() + "',";
sql += "是否必填=" + (rbYes.Checked ? 1 : 0) + " where ID="+CGWJID;
}
if (ah.ExecuteSQLNonquery(sql))
{
this.DialogResult = DialogResult.OK;
MessageBox.Show("保存成功");
this.Close();
}
else
{
MessageBox.Show("保存失败");
}
ah.Close();
}
}
示例5: btnDel_Click
/// <summary>
/// 删除成果目录配置
/// </summary>
private void btnDel_Click(object sender, EventArgs e)
{
MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
DialogResult dr = MessageBox.Show("确定要删除吗?", "删除选定数据", messButton);
if (dr == DialogResult.OK)//如果点击“确定”按钮
{
AccessHelper ah = new AccessHelper();
string sql = "delete from MuLu where ID=" + dataGridView1.SelectedRows[0].Cells[0].Value;
if (ah.ExecuteSQLNonquery(sql))
{
this.muLuTableAdapter.Fill(this.settingDataSet.MuLu);
}
else
{
MessageBox.Show("删除失败");
}
}
}
示例6: btnSave_Click
/// <summary>
/// 新增/修改指标表配置项
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSave_Click(object sender, EventArgs e)
{
if(CheckMsg())
{
AccessHelper ah = new AccessHelper();
string sql = string.Empty;
if (IntZhiBiaoId == 0)//新增
{
if (!ExistZhiBiaoByTableAndRow(tbTableName.Text.Trim(),tbColName.Text.Trim()))
{
MessageBox.Show("存在相同表名和列名数据!");
return;
}
sql = "insert into ZhiBiao(表名,列名,列描述,数据类型编码,数据类型,数据长度,数据精度) values('" + tbTableName.Text.Trim() + "',";
sql += "'" + tbColName.Text.Trim() + "',";
sql += "'" + tbColRemark.Text.Trim() + "'," + GetDataType(cbType.Text) + ",'";
sql += "" + cbType.Text.Trim() + "',";
sql += "" + tbDataLen.Text.Trim() + ",";
sql += "" + tbDataProcision.Text.Trim() + ")";
}
else//修改
{
sql = "update ZhiBiao set 表名='" + tbTableName.Text.Trim() + "',列名='";
sql += "" + tbColName.Text.Trim() + "'";
sql += ",列描述='" + tbColRemark.Text.Trim() + "'";
sql += ",数据类型编码=" + GetDataType(cbType.Text) + "";
sql += ",数据类型='" + cbType.Text.Trim() + "'";
sql += ",数据长度=" + tbDataLen.Text.Trim() + "";
sql += ",数据精度=" + tbDataProcision.Text.Trim() + " where ID=" + IntZhiBiaoId + "";
}
if (ah.ExecuteSQLNonquery(sql))
{
this.DialogResult = DialogResult.OK;
MessageBox.Show("保存成功");
this.Close();
}
else
{
MessageBox.Show("保存失败");
}
ah.Close();
}
}
示例7: btnSave_Click
/// <summary>
/// 保存编辑的数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSave_Click(object sender, EventArgs e)
{
if(CheckMsg())
{
//access帮助类
AccessHelper ah = new AccessHelper();
string sql = string.Empty;//sql语句
if (!ExistGZ(GetDJLXType(cbDJLX.Text.Trim()), cbGZLX.Text.Trim(), tbGZBH.Text.Trim(), tbGZZBH.Text.Trim()))
{
sql = "insert into GuiZe(登记类型,规则类型,规则编号,规则子编号,规则名称,错误描述,严重程度,校验类型,表达式,表名,字段名,是否检查) values(";
sql += "'" + GetDJLXType(cbDJLX.Text.Trim()) + "',";
sql += "'" + cbGZLX.Text.Trim() + "',";
sql += "'" + tbGZBH.Text.Trim() + "',";
sql += "" + tbGZZBH.Text.Trim() + ",";
sql += "'" + tbGZMC.Text.Trim() + "',";
sql += "'" + tbCWMS.Text.Trim() + "',";
sql += "'" + (rbZQX.Checked ? "重缺陷" : "轻缺陷") + "',";
sql += "'" + cbXYLX.Text.Trim() + "',";
sql += "'" + tbBDS.Text.Trim() + "',";
sql += "'" + tbBM.Text.Trim() + "',";
sql += "'" + tbZDM.Text.Trim() + "',";
sql += "'" + (rbCheck.Checked ? 1 : 0) + "')";
}
else
{
sql = "update GuiZe set 登记类型='" + GetDJLXType(cbDJLX.Text.Trim()) + "',";
sql += "规则类型='" + cbGZLX.Text.Trim() + "',规则编号='" + tbGZBH.Text.Trim() + "',";
sql += "规则子编号='" + tbGZZBH.Text.Trim() + "',规则名称='"+tbGZMC.Text.Trim()+"'";
sql += ",错误描述='" + tbCWMS.Text.Trim() + "',严重程度='" + (rbZQX.Checked ? "重缺陷" : "轻缺陷") + "',";
sql += "校验类型='" + cbXYLX.Text.Trim() + "',表达式='" + tbBDS.Text.Trim() + "',";
sql+="表名='"+tbBM.Text.Trim()+"',字段名='"+tbZDM.Text.Trim()+"',";
sql += "是否检查=" + (rbCheck.Checked ? 1 : 0) + " where ID="+GZID;
}
if (ah.ExecuteSQLNonquery(sql))
{
this.DialogResult = DialogResult.OK;
MessageBox.Show("保存成功");
this.Close();
}
else
{
MessageBox.Show("保存失败");
}
ah.Close();
}
}