コード例 #1
0
 //更新
 //public bool UpdateProducts(int PID,int CategoryID,string Name,string Description)
 //{
 //    if (helper.ExcuteCommandInt("update Products set CategoryID=" + CategoryID + ",Name='" + Name + "',Description='" + Description + "' where PID=" + PID + "") > 0)
 //        return true;
 //    else
 //        return false;
 //}
 public bool UpdateProducts(Entity.Products product)
 {
     if (helper.ExcuteCommandInt("update Products set CategoryID=" 
         +product.getCategoryID()+ ",Name='" 
         +product.getName()+ "',Description='" 
         +product.getDescription()+ "' where PID="
         + product.getPID() + "") > 0)
         return true;
     else
         return false;
 }
コード例 #2
0
 //新增
 //public bool AddProduct(int CategoryID,string Name,string Description) {
 //    if (helper.ExcuteCommandInt("insert into Products(CategoryID,Name,Description) values("+CategoryID+",'"+Name+"','"+Description+"')") > 0)
 //        return true;
 //    else
 //        return false;
 //}
 public bool AddProduct(Entity.Products product)
 {
     //int CategoryID, string Name, string Description
     if (helper.ExcuteCommandInt("insert into Products(CategoryID,Name,Description) values(" 
         + product.getCategoryID() + ",'" 
         + product.getName()+ "','" 
         +product.getDescription() + "')") > 0)
         return true;
     else
         return false;
 }