private void btnSave_Click_1(object sender, EventArgs e) { try { //double total; //DateTime today = DateTime.Now; //total =double.Parse(txtPrice.Text) * Int32.Parse (txtQty.Text); //pro.sqladd = "INSERT INTO tblstockin (Barcode,DateReceived,Price,ReceivedQty,SubTotal,UserId) " + // " Values('" + txtBarcode.Text + "','" + today + "','" + txtPrice.Text + "','" + txtQty.Text + "','" + total + "',1)"; //pro.SaveData(pro.sqladd); pro.sqlselect = "SELECT * FROM tblproduct WHERE ProductId='" + lblProductId.Text + "'"; pro.sqladd = "INSERT INTO tblproduct (ProductId,Barcode,ProductName,Description,OriginalPrice,MarkupPrice,ProductQty,CategoryId) " + " VALUES ('" + lblProductId.Text + "','" + txtBarcode.Text + "','" + txtProduct.Text + "','" + txtDescription.Text + "','" + txtPrice.Text + "','" + txtMarkupPrice.Text + "',0," + cboCategory.SelectedValue + ")"; pro.sqledit = "UPDATE tblproduct Set ProductId='" + lblProductId.Text + "',Barcode='" + txtBarcode.Text + "',ProductName='" + txtProduct.Text + "',Description='" + txtDescription.Text + "',OriginalPrice='" + txtPrice.Text + "',MarkupPrice='" + txtMarkupPrice.Text + "',CategoryId=" + cboCategory.SelectedValue + " WHERE ProductId = '" + lblProductId.Text + "'"; pro.msgadd = "New Product has been saved in the database."; pro.msgedit = "Product has been updated in the database."; pro.SaveUpdate(pro.sqlselect, pro.sqladd, pro.msgadd, pro.sqledit, pro.msgedit); if (pro.msg == "New Product has been saved in the database.") { pro.UpdateProductAutonumber(cboCategory); pro.msg = ""; } frmProduct_Load(sender, e); } catch (Exception ex) { } }