public int JhGoodsAdd(getJinhuo tbGood) { int intFalg = 0; try { string str_Add = "insert into test values( "; str_Add += "'" + tbGood.getGoodsID + "','" + tbGood.getEmpId + "','" + tbGood.getJhCompName + "',"; str_Add += "'" + tbGood.getDepotName + "','" + tbGood.getGoodsName + "','" + tbGood.getGoodsNum + "',"; str_Add += "'" + tbGood.getGoodsJhPrice + "',"; str_Add += "'" + tbGood.getGoodTime + "','" + tbGood.getFalg + "')"; str_Add += "insert into KcGoods(KcID,KcGoodsName,KcNum,KcDeptName) values( "; str_Add += "'" + tbGood.getGoodsID + "','" + tbGood.getGoodsName + "',"; str_Add += tbGood.getGoodsNum + ",'" + tbGood.getDepotName + "')"; 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 JhGoodsDelete(getJinhuo tbGood) { int intFalg = 0; try { string str_Del = "delete from test where GoodsID ='" + tbGood.getGoodsID + "'"; str_Del += "delete from KcGoods where KcGoodsName = '" + tbGood.getGoodsName + "'"; getSqlConnection getConnection = new getSqlConnection(); conn = getConnection.GetCon(); cmd = new SqlCommand(str_Del, conn); intFalg = cmd.ExecuteNonQuery(); conn.Dispose(); return(intFalg); } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
public int JhGoodsUpdate(getJinhuo tbGood) { int intFalg = 0; try { string str_Update = "update test set "; str_Update += "EmpId='" + tbGood.getEmpId + "',JhCompName='" + tbGood.getJhCompName + "',"; str_Update += "DepotName='" + tbGood.getDepotName + "',GoodsName='" + tbGood.getGoodsName + "',GoodsNum='" + tbGood.getGoodsNum + "',"; str_Update += "GoodsJhPrice=" + tbGood.getGoodsJhPrice + ","; str_Update += "GoodTime='" + tbGood.getGoodTime + "',Falg='" + tbGood.getFalg + "' where GoodsID ='" + tbGood.getGoodsID + "'"; 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); } }