内容发布更新时间 : 2024/11/5 6:00:19星期一 下面是文章的全部内容请认真阅读。
{
this.msqlCon = new SqlConnection(mstrCon);
SqlCommand myCmd = new SqlCommand(\msqlCon);
myCmdmandType = CommandType.StoredProcedure; 给存储过程添加参数
SqlParameter myID = new SqlParameter(\SqlDbType.NVarChar, 20);
myID.Value = tempGoodsID; myCmd.Parameters.Add(myID); 执行存储过程 try {
msqlCon.Open();
myCmd.ExecuteNonQuery(); return true; } catch {
return false; } finally {
msqlCon.Close(); }
}
判断是否存在商品
public bool HasGoods(string tempGoodsID) {
this.msqlCon = new SqlConnection(mstrCon);
SqlCommand myCmd = new SqlCommand(\msqlCon);
myCmdmandType = CommandType.StoredProcedure; 给存储过程添加参数
SqlParameter myID = new SqlParameter(\SqlDbType.NVarChar, 20);
myID.Value = tempGoodsID; myCmd.Parameters.Add(myID);
SqlParameter flag = new SqlParameter(\ParameterDirection.Output;
myCmd.Parameters.Add(flag); try {
msqlCon.Open();
myCmd.ExecuteNonQuery();
return (Convert.ToBoolean(flag.Value)); } catch {
return false; } finally {
msqlCon.Close(); } }
判断某供应商是否提供某商品
public bool IsSupplyGds(string tempCmp,string tempGoodsID) {
this.msqlCon = new SqlConnection(mstrCon);
SqlCommand myCmd = new SqlCommand(\msqlCon);
myCmdmandType = CommandType.StoredProcedure; 给存储过程添加参数
SqlParameter myID = new SqlParameter(\SqlDbType.NVarChar, 20);
myID.Value = tempGoodsID; myCmd.Parameters.Add(myID);
SqlParameter myCmp=new
SqlParameter(\ myCmp.Value=tempCmp; myCmd.Parameters.Add(myCmp);
SqlParameter myflag=new SqlParameter(\
myflag.Direction = ParameterDirection.Output; myCmd.Parameters.Add(myflag); 执行存储过程 try {
msqlCon.Open();
myCmd.ExecuteNonQuery();
return Convert.ToBoolean(myflag.Value); } catch {
return false; } finally {
msqlCon.Close(); } } 增加库存
public bool AddStock(string tempStockID,string
tempGoodsID,string tempCmp,string tempOperator,float tempPrice,int tempNum,string tempRemark,int tempflag) {