本文整理匯總了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();
}
}