} //End Of Insert Function public static void DeleteData(ProductClass sale) { string query = "Delete From ProductFormTable Where ProductName='" + sale.Name.ToUpper() + "' and ProductSaleRate='" + sale.Saleprice.ToUpper() + "'"; try { DataTable _dTable = null; _dTable = dbAccess.ReadDataFromDb(query); } catch (Exception ex) { throw ex; } } //End Of delete Function
} //End Of Insert Function public static void InsertData(ProductClass stock) { string query = "INSERT INTO ProductFormTable (CompanyID,ProductName,ProductCatagory,ProductPurchasePrice,ProductSalePrice,Packing ) VALUES('" + stock.Name.ToUpper() + "','" + stock.Company.ToUpper() + "' ,'" + stock.Catagory + "','" + stock.Purchaseprice + "','" + stock.Saleprice + "','" + stock.Packing + "');"; try { DataTable _dtable = null; _dtable = dbAccess.ReadDataFromDb(query); } catch (Exception ex) { throw ex; } } //End Of Insert Function
private void SaveBtn_Click(object sender, EventArgs e) { ProductClass os = new ProductClass(); try { os.Name = NameTxt.Text.Trim(); os.Company = CompanyTxt.Text.Trim(); os.Catagory = CatagoryTxt.Text; os.Packing = PackingTxt.Text; os.Purchaseprice = PurchasePTxt1.Text; os.Saleprice = SalePtxt.Text; // QueryClass.InsertData(fs); MessageBox.Show("Add Successfully"); } catch (Exception ex) { MessageBox.Show("Error", ex.Message); } }