public void SaveOrder() { if (!Check()) { string ConString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=D:\Customer_Purchase_Order_System\DataBase\stretchline.mdf;Integrated Security=True;Connect Timeout=30"; string InsertQuery = "INSERT INTO tbl_salesOrder(po_no, contact, email, tel, fax, deliver_location, delivary_type, delivery_date, bill_address, item_code, color_shade, quantity, unit_price, total_price, currency, payment_term, inco_term, end_buyer, order_date, entry_date, cus_name, cus_email, cus_add, confirmation) VALUES (" + Po_no + ", '" + Contact + "', '" + Email + "', '" + Tel + "', '" + Fax + "', '" + Deliver_Location + "', '" + Delivary_Type + "', '" + Delivary_Date + "', '" + Bill_Address + "', '" + Item_Code + "', '" + Color_Shade + "', " + Quantity + ", " + Unit_Price + ", " + Total_Price + ", '" + Currency + "', '" + Payment_Term + "', '" + Inco_Term + "', '" + End_Buyer + "', '" + Order_Date + "', '" + Entry_Date + "', '" + Cus_name + "', '" + Cus_mail + "', '" + Cus_add + "', 'NA')"; var con = new SqlConnection(ConString); var cmd = new SqlCommand(InsertQuery, con); try { con.Open(); cmd.ExecuteNonQuery(); Notifier ntf = new Notifier(Po_no.ToString()); ntf.SendMailSupervisor(); } catch (Exception) { MessageBox.Show("Connection_Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { con.Close(); } } else { MessageBox.Show("You have already saved this order", "Look Out!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }