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_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); } }