public int tb_EmpInfoUpdate(_EmpInfo Empinfo) { int intFalg = 0; try { string str_Update = "update tb_EmpInfo set "; str_Update += "EmpName='" + Empinfo.strEmpName + "',EmpLoginName='" + Empinfo.strEmpLoginName + "',"; str_Update += "EmpLoginPwd='" + Empinfo.strEmpLoginPwd + "',EmpSex='" + Empinfo.intEmpSex + "',EmpBirthday='" + Empinfo.daEmpBirthday + "',"; str_Update += "EmpDept= '" + Empinfo.strEmpDept + "',EmpPost='" + Empinfo.strEmpPost + "',EmpPhone='" + Empinfo.strEmpPhone + "',"; str_Update += " EmpPhoneM='" + Empinfo.strEmpPhoneM + "',EmpAddress='" + Empinfo.strEmpAddress + "',"; str_Update += "EmpFalg=" + Empinfo.intEmpFalg + " where EmpId='" + Empinfo.intEmpId + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Update, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
public int tb_KcGoodsUpdate(string kcGood, int striID) { int intFalg = 0; try { string str_Add = "update tb_KcGoods set "; str_Add += "KcAlarmNum=" + striID + " "; str_Add += " where GoodsID ='" + kcGood + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
public int tb_ThGoodsUpdate(_ThGoodsInfo tbChGood) { int intFalg = 0; try { string str_Add = "update tb_ThGoodsInfo set "; str_Add += "KcID='" + tbChGood.strKcID + "',GoodsID='" + tbChGood.strGoodsID + "',"; str_Add += "SellID='" + tbChGood.strSellID + "',EmpId='" + tbChGood.intEmpId + "',ThGoodsName='" + tbChGood.strThGoodsName + "',"; str_Add += "ThGoodsNum=" + tbChGood.intThGoodsNum + ",ThGoodsTime='" + tbChGood.daThGoodsTime + "',ThGoodsPrice=" + tbChGood.deThGoodsPrice + ","; str_Add += "ThHasPay=" + tbChGood.deThHasPay + ",ThNeedPay=" + tbChGood.deThNeedPay + ",ThGoodsResult='" + tbChGood.deThGoodsResult + "' where ThGoodsID='" + tbChGood.strThGoodsID + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
public int tb_SellGoodsUpdate(_SellGoods tbChGood) { int intFalg = 0; try { string str_Add = "update tb_SellGoods set "; str_Add += "KcID='" + tbChGood.strKcID + "',GoodsID='" + tbChGood.strGoodsID + "',"; str_Add += "EmpId='" + tbChGood.strEmpId + "',GoodsName='" + tbChGood.strGoodsName + "',SellGoodsNum=" + tbChGood.strSellGoodsNum + ","; str_Add += "SellGoodsTime='" + tbChGood.daSellGoodsTime + "',SellPrice=" + tbChGood.deSellPrice + ","; str_Add += "SellNeedPay=" + tbChGood.deSellNeedPay + ",SellHasPay=" + tbChGood.deSellHasPay + ",SellRemark='" + tbChGood.strSellRemark + "',SellFalg=" + tbChGood.intSellFalg + ""; str_Add += " where SellID= '" + tbChGood.strSellID + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
}// end fi #endregion public string fillfrmKcGoods(string strID) { string SID = ""; try { string strSecar = "select kcid from tb_KcGoods where GoodsID ='" + strID + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(strSecar, conn); qlddr = cmd.ExecuteReader(); qlddr.Read(); if (qlddr.HasRows) { SID = qlddr[0].ToString(); } qlddr.Close(); return(SID); } catch (Exception ee) { MessageBox.Show(ee.Message.ToString()); return(SID); } }
public int tb_EmpInfoAdd(_EmpInfo Empinfo) { int intFalg = 0; try { string str_Add = "insert into tb_EmpInfo values( "; str_Add += " '" + Empinfo.intEmpId + "','" + Empinfo.strEmpName + "','" + Empinfo.strEmpLoginName + "',"; str_Add += " '" + Empinfo.strEmpLoginPwd + "','" + Empinfo.intEmpSex + "','" + Empinfo.daEmpBirthday + "',"; str_Add += " '" + Empinfo.strEmpDept + "','" + Empinfo.strEmpPost + "','" + Empinfo.strEmpPhone + "',"; str_Add += " '" + Empinfo.strEmpPhoneM + "','" + Empinfo.strEmpAddress + "',"; str_Add += "" + Empinfo.intEmpFalg + ")"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
public SqlDataReader tb_EmpInfoFind(string strObject, int intFalg) { int intCount = 0; string strSecar = null; try { switch (intFalg) { case 1: strSecar = "select * from tb_EmpInfo where EmpId= '" + strObject + "' and EmpFalg=0"; break; case 2: strSecar = "select * from tb_EmpInfo where EmpFalg=0"; break; } strSecar = "select * from tb_EmpInfo where EmpId= '" + strObject + "' and EmpFalg=0"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(strSecar, conn); qlddr = cmd.ExecuteReader(); return(qlddr); } catch (Exception ee) { return(qlddr); } }
}// end if #endregion #region //填冲商品类别信息 TrreView控件 public void filltProd(object objTreeView, object obimage) { try { _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); string strSecar = "select * from tb_Company where Falg=0"; cmd = new SqlCommand(strSecar, conn); qlddr = cmd.ExecuteReader(); if (objTreeView.GetType().ToString() == "System.Windows.Forms.TreeView") { System.Windows.Forms.ImageList imlist = (System.Windows.Forms.ImageList)obimage; System.Windows.Forms.TreeView TV = (System.Windows.Forms.TreeView)objTreeView; TV.Nodes.Clear(); TV.ImageList = imlist; System.Windows.Forms.TreeNode TN = new System.Windows.Forms.TreeNode("供应商名称", 0, 1); while (qlddr.Read()) { TN.Nodes.Add("", qlddr[1].ToString(), 0, 1); } TV.Nodes.Add(TN); qlddr.Close(); TV.ExpandAll(); } }// catch (Exception ee) { MessageBox.Show(ee.ToString()); } }// end fi
public int tb_JhGoodsInfoMenthodUpdate(_JhGoodsInfo tbGood) { int intFalg = 0; try { string str_Add = "update tb_JhGoodsInfo set "; str_Add += "EmpId='" + tbGood.strEmpId + "',JhCompName='" + tbGood.strJhCompName + "',"; str_Add += "DepotName='" + tbGood.strDepotName + "',GoodsName='" + tbGood.strGoodsName + "',GoodsNum='" + tbGood.strGoodsNum + "',"; str_Add += "GoodsUnit='" + tbGood.strGoodsUnit + "',GoodsJhPrice=" + tbGood.deGoodsJhPrice + " ,GoodsSellPrice=" + tbGood.deGoodsSellPrice + " ,"; str_Add += "GoodsNeedPrice=" + tbGood.deGoodsNeedPrice + ",GoodsNoPrice=" + tbGood.deGoodsNoPrice + ",GoodsRemark='" + tbGood.strGoodsRemark + "',"; str_Add += "GoodTime='" + tbGood.DaGoodTime + "',Falg='" + tbGood.Falg + "' where GoodsID ='" + tbGood.strGoodsID + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
public int tb_JhGoodsInfoMenthodAdd(_JhGoodsInfo tbGood) { int intFalg = 0; try { //string str_Add = "insert into tb_JhGoodsInfo values( "; //str_Add += "'" + tbGood.strGoodsID + "','" + tbGood.strEmpId + "','" + tbGood.strJhCompName + "',"; //str_Add += "'" + tbGood.strDepotName + "','" + tbGood.strGoodsName + "','" + tbGood.strGoodsNum + "',"; //str_Add += "'" + tbGood.strGoodsUnit + "','" + tbGood.deGoodsJhPrice + "','" + tbGood.deGoodsSellPrice + "',"; //str_Add += "'" + tbGood.deGoodsNeedPrice + "','" + tbGood.deGoodsNoPrice + "','" + tbGood.strGoodsRemark + "',"; //str_Add += "'" + tbGood.Falg + "')"; string str_Add = "insert into tb_JhGoodsInfo values( "; str_Add += "'" + tbGood.strGoodsID + "','" + tbGood.strEmpId + "','" + tbGood.strJhCompName + "',"; str_Add += "'" + tbGood.strDepotName + "','" + tbGood.strGoodsName + "','" + tbGood.strGoodsNum + "',"; str_Add += "'" + tbGood.strGoodsUnit + "'," + tbGood.deGoodsJhPrice + " ," + tbGood.deGoodsSellPrice + " ,"; str_Add += "" + tbGood.deGoodsNeedPrice + "," + tbGood.deGoodsNoPrice + ",'" + tbGood.strGoodsRemark + "',"; str_Add += "'" + tbGood.DaGoodTime + "'," + tbGood.Falg + ")"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
public SqlDataReader tb_JhGoodsInfoFind(string strObject, int intFalg) { int intCount = 0; string strSecar = null; try { switch (intFalg) //判断条件 { case 1: //"编号查 strSecar = "select * from tb_JhGoodsInfo where GoodsID = '" + strObject + "' and Falg=0"; break; case 2: //全部果询 strSecar = "select * from tb_JhGoodsInfo where Falg=0"; break; } _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(strSecar, conn); qlddr = cmd.ExecuteReader(); return(qlddr); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(qlddr); } }
public int tb_KcGoodsAdd(_KcGoods kcGood) { int intFalg = 0; try { string str_Add = "insert into tb_KcGoods values( "; str_Add += "'" + kcGood.strGoodsID + "','" + kcGood.strJhCompName + "',"; str_Add += "'" + kcGood.strKcDeptName + "','" + kcGood.strKcGoodsName + "'," + kcGood.intKcNum + ","; str_Add += "" + kcGood.intKcAlarmNum + ",'" + kcGood.intKcUnit + "','" + kcGood.daKcTime + "',"; str_Add += "" + kcGood.deKcGoodsPrice + "," + kcGood.deKcSellPrice + ",'" + kcGood.strKcEmp + "',"; str_Add += "'" + kcGood.strKcRemark + "')"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
public void filltProd(object objTreeView, object obimage) { try { _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); string strSecar = "select * from tb_SellGoods "; cmd = new SqlCommand(strSecar, conn); qlddr = cmd.ExecuteReader(); if (objTreeView.GetType().ToString() == "System.Windows.Forms.TreeView") { System.Windows.Forms.ImageList imlist = (System.Windows.Forms.ImageList)obimage; System.Windows.Forms.TreeView TV = (System.Windows.Forms.TreeView)objTreeView; TV.Nodes.Clear(); TV.ImageList = imlist; System.Windows.Forms.TreeNode TN = TV.Nodes.Add("A", "商品销售信息", 0, 1); while (qlddr.Read()) { TreeNode newNode12 = new TreeNode(qlddr[0].ToString(), 0, 1); newNode12.Nodes.Add("A", qlddr[4].ToString(), 0, 1); TN.Nodes.Add(newNode12); } qlddr.Close(); TV.ExpandAll(); } } catch (Exception ee) { MessageBox.Show(ee.ToString()); } }
public int tb_CompanyMenthodUpDate(_Company Company) { int intFalg = 0; try { string str_Add = "update tb_Company set "; str_Add += "CompanyName='" + Company.strCompanyName + "',CompanyDirector='" + Company.strCompanyDirector + "',"; str_Add += "CompanyPhone='" + Company.strCompanyPhone + "',CompanyFax='" + Company.strCompanyFax + "',CompanyAddress='" + Company.strCompanyAddress + "',"; str_Add += "CompanyRemark='" + Company.strCompanyRemark + "',ReDateTime='" + Company.daReDateTime + "',Falg='" + Company.intEmpFalg + "' where CompanyID ='" + Company.intCompanyID + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
public int tb_KcGoodsUpdate(_KcGoods kcGood) { int intFalg = 0; try { string str_Add = "update tb_KcGoods set "; str_Add += "KcDeptName='" + kcGood.strKcDeptName + "',KcNum=" + kcGood.intKcNum + ","; str_Add += "KcAlarmNum=" + kcGood.intKcAlarmNum + ",KcTime='" + kcGood.daKcTime + "',"; str_Add += "KcGoodsPrice=" + kcGood.deKcGoodsPrice + ",KcSellPrice=" + kcGood.deKcSellPrice + ",KcEmp='" + kcGood.strKcEmp + "',"; str_Add += "KcRemark='" + kcGood.strKcRemark + "' where GoodsID ='" + kcGood.strGoodsID + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
}// end if #endregion #region 查询 public void tb_ThGoodsFind(Object DataObject) { int intCount = 0; string strSecar = null; try { strSecar = "select * from tb_ThGoodsInfo "; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(strSecar, conn); int ii = 0; qlddr = cmd.ExecuteReader(); while (qlddr.Read()) { ii++; } qlddr.Close(); System.Windows.Forms.DataGridView dv = (DataGridView)DataObject; if (ii != 0) { int i = 0; dv.RowCount = ii; qlddr = cmd.ExecuteReader(); while (qlddr.Read()) { dv[0, i].Value = qlddr[0].ToString(); dv[1, i].Value = qlddr[3].ToString(); dv[2, i].Value = qlddr[5].ToString(); dv[3, i].Value = qlddr[8].ToString(); dv[4, i].Value = qlddr[6].ToString(); i++; } qlddr.Close(); } else { if (dv.RowCount != 0) { int i = 0; do { dv[0, i].Value = ""; dv[1, i].Value = ""; dv[2, i].Value = ""; dv[3, i].Value = ""; i++; } while (i < dv.RowCount); } } } catch (Exception ee) { MessageBox.Show(ee.ToString()); } }
public int tb_EmpInfoDelete(_EmpInfo Empinfo) { int intFalg = 0; try { string str_Update = "update tb_EmpInfo set "; str_Update += "EmpFalg='" + Empinfo.intEmpFalg + "' where EmpId='" + Empinfo.intEmpId + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Update, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { return(intFalg); } }
public SqlDataReader dtb_SellGoodsFind(string DataObject) { string strSecar = null; try { strSecar = "select * from tb_SellGoods where SellID='" + DataObject + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(strSecar, conn); qlddr = cmd.ExecuteReader(); return(qlddr); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(qlddr); } }
public int tb_CompanyMenthodAdd(_Company Company) { int intFalg = 0; try { string str_Add = "insert into tb_Company values( "; str_Add += "'" + Company.intCompanyID + "','" + Company.strCompanyName + "','" + Company.strCompanyDirector + "',"; str_Add += "'" + Company.strCompanyPhone + "','" + Company.strCompanyFax + "','" + Company.strCompanyAddress + "',"; str_Add += "'" + Company.strCompanyRemark + "','" + Company.daReDateTime + "','" + Company.intEmpFalg + "')"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { return(intFalg); } }
public int tb_JhGoodsInfoMenthodDelete(_JhGoodsInfo tbGood) { int intFalg = 0; try { string str_Add = "update tb_JhGoodsInfo set "; str_Add += "Falg=" + tbGood.Falg + " where GoodsID ='" + tbGood.strGoodsID + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
public SqlDataReader tb_JhGoodsInfoFind(string strObject) { int intCount = 0; string strSecar = null; try { strSecar = "select * from tb_thgoodsinfo where thGoodsid= '" + strObject + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(strSecar, conn); qlddr = cmd.ExecuteReader(); return(qlddr); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(qlddr); } }
public int tb_EmpInfoFind(string strObject, string pwwd, int intFalg) { int intCount = 0; string strSecar = null; try { switch (intFalg) { case 1: strSecar = "select * from tb_EmpInfo where EmpLoginName= '" + strObject + "' and EmpFalg=0"; break; case 2: strSecar = "select * from tb_EmpInfo where EmpLoginName= '" + strObject + "' and EmpFalg=0 and EmpLoginPwd='" + pwwd + "'"; break; } _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(strSecar, conn); qlddr = cmd.ExecuteReader(); qlddr.Read(); if (qlddr.HasRows) { intCount = 1; } return(intCount); } catch (Exception ee) { MessageBox.Show(ee.Message.ToString()); return(intCount = 2); } }
public SqlDataReader tb_CompanyFind(string strObject) { string strSecar = null; try { strSecar = "select * from tb_Company where CompanyID = '" + strObject + "' and Falg= 0"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(strSecar, conn); int ii = 0; qlddr = cmd.ExecuteReader(); return(qlddr); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(qlddr); } }
public int tb_CompanyMenthodDelete(_Company Company) { int intFalg = 0; try { string str_Add = "update tb_Company set "; str_Add += "Falg='" + Company.intEmpFalg + "' where CompanyID ='" + Company.intCompanyID + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
}// end if #endregion #region 除 public int tb_ThGoodsDelete(string striThid) { int intFalg = 0; try { string str_Add = "delete from tb_thgoodsinfo where ThGoodsID='" + striThid + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
public int tb_ThGoodsAdd(_ThGoodsInfo tbChGood) { int intFalg = 0; try { string str_Add = "insert into tb_ThGoodsInfo values( "; str_Add += "'" + tbChGood.strThGoodsID + "','" + tbChGood.strKcID + "','" + tbChGood.strGoodsID + "',"; str_Add += "'" + tbChGood.strSellID + "','" + tbChGood.intEmpId + "','" + tbChGood.strThGoodsName + "',"; str_Add += "" + tbChGood.intThGoodsNum + ",'" + tbChGood.daThGoodsTime + "'," + tbChGood.deThGoodsPrice + ","; str_Add += "" + tbChGood.deThHasPay + "," + tbChGood.deThNeedPay + ",'" + tbChGood.deThGoodsResult + "')"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
public int tb_SellGoodsDelete(_SellGoods tbChGood) { int intFalg = 0; try { string str_Add = "update tb_SellGoods set "; str_Add += "SellFalg=" + tbChGood.intSellFalg + ""; str_Add += " where SellID= '" + tbChGood.strSellID + "'"; _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Add, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
public void tb_ThGoodsFind(object DataObject, int intFalg, _KcGoods kcGood) { int intCount = 0; string strSecar = null; try { switch (intFalg) { case 1: strSecar = "select * from tb_KcGoods where GoodsID like '%" + kcGood.strGoodsID + "%'"; break; case 2: strSecar = "select * from tb_KcGoods where KcGoodsName like '%" + kcGood.strKcGoodsName + "%'"; break; case 4: strSecar = "select * from tb_KcGoods "; break; } _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(strSecar, conn); int ii = 0; qlddr = cmd.ExecuteReader(); while (qlddr.Read()) { ii++; } qlddr.Close(); System.Windows.Forms.DataGridView dv = (DataGridView)DataObject; if (ii != 0) { int i = 0; dv.RowCount = ii; qlddr = cmd.ExecuteReader(); while (qlddr.Read()) { dv[0, i].Value = qlddr[1].ToString(); dv[1, i].Value = qlddr[4].ToString(); dv[2, i].Value = qlddr[3].ToString(); dv[3, i].Value = qlddr[5].ToString(); dv[4, i].Value = qlddr[6].ToString(); i++; } qlddr.Close(); } else { if (dv.RowCount != 0) { int i = 0; do { dv[0, i].Value = ""; dv[1, i].Value = ""; dv[2, i].Value = ""; dv[3, i].Value = ""; dv[4, i].Value = ""; i++; } while (i < dv.RowCount); } } } catch (Exception ee) { MessageBox.Show(ee.ToString()); } }
public void tb_CompanyFind(string strObject, int intFalg, Object DataObject) { int intCount = 0; string strSecar = null; try { switch (intFalg) //判断条件 { case 1: //"员工姓名": strSecar = "select * from tb_Company where CompanyName like '%" + strObject + "%' and Falg= 0"; break; case 2: //员工性别 strSecar = "select * from tb_Company where CompanyDirector like '%" + strObject + "%' and Falg= 0"; break; case 3: strSecar = "select * from tb_Company where Falg= 0"; break; } _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(strSecar, conn); int ii = 0; qlddr = cmd.ExecuteReader(); while (qlddr.Read()) { ii++; } qlddr.Close(); System.Windows.Forms.DataGridView dv = (DataGridView)DataObject; if (ii != 0) { int i = 0; dv.RowCount = ii; qlddr = cmd.ExecuteReader(); while (qlddr.Read()) { dv[0, i].Value = qlddr[0].ToString(); dv[1, i].Value = qlddr[1].ToString(); dv[2, i].Value = qlddr[2].ToString(); dv[3, i].Value = qlddr[3].ToString(); dv[4, i].Value = qlddr[5].ToString(); i++; } qlddr.Close(); } else { for (int i = 0; i < dv.RowCount; i++) { dv[0, i].Value = ""; dv[1, i].Value = ""; dv[2, i].Value = ""; dv[3, i].Value = ""; dv[4, i].Value = ""; } } } catch (Exception ee) { } }
public void tb_JhGoodsInfoFind(string strObject, int intFalg, Object DataObject) { int intCount = 0; string strSecar = null; try { switch (intFalg) //判断条件 { case 1: //"商品编号": strSecar = "select * from tb_JhGoodsInfo where GoodsID like '%" + strObject + "%' and Falg=0"; break; case 2: //商品名称" strSecar = "select * from tb_JhGoodsInfo where GoodsName like '%" + strObject + "%' and Falg=0"; break; case 3: //所属部门" strSecar = "select * from tb_JhGoodsInfo where JhCompName like '%" + strObject + "%' and alg=0"; break; case 4: //"员工职位": strSecar = "select * from tb_JhGoodsInfo where DepotName like '%" + strObject + "%' and Falg=0"; break; case 5: //"员工职位": strSecar = "select * from tb_JhGoodsInfo where Falg=0"; break; } _getSqlConnection getConnection = new _getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(strSecar, conn); int ii = 0; qlddr = cmd.ExecuteReader(); while (qlddr.Read()) { ii++; } qlddr.Close(); System.Windows.Forms.DataGridView dv = (DataGridView)DataObject; if (ii != 0) { int i = 0; dv.RowCount = ii; qlddr = cmd.ExecuteReader(); while (qlddr.Read()) { dv[0, i].Value = qlddr[0].ToString(); dv[1, i].Value = qlddr[4].ToString(); dv[2, i].Value = qlddr[2].ToString(); dv[3, i].Value = qlddr[3].ToString(); dv[4, i].Value = qlddr[5].ToString(); dv[5, i].Value = qlddr[7].ToString(); dv[6, i].Value = qlddr[8].ToString(); i++; } qlddr.Close(); } else { if (dv.RowCount != 0) { int i = 0; do { dv[0, i].Value = ""; dv[1, i].Value = ""; dv[2, i].Value = ""; dv[3, i].Value = ""; dv[4, i].Value = ""; dv[5, i].Value = ""; dv[6, i].Value = ""; i++; } while (i < dv.RowCount); } } } catch (Exception ee) { MessageBox.Show(ee.ToString()); } }