} //End Of Insert Function public static void InsertData(InvoiceInfoClass stock) { string query = "INSERT INTO InvoiceTable (CustomerName, InvoiceNumber, Date ) VALUES('" + stock.CustomerName.ToUpper() + "','" + stock.Invoice + "','" + stock.Date + "' );"; try { DataTable _dtable = null; _dtable = dbAccess.ReadDataFromDb(query); } catch (Exception ex) { throw ex; } } //End Of Insert Function
private void button1_Click_1(object sender, EventArgs e) { InvoiceInfoClass fs = new InvoiceInfoClass(); try { fs.CustomerName = customerNameTextbox.Text.Trim(); fs.Invoice = Convert.ToInt32(invoiceTextBox.Text.Trim()); fs.Date = Convert.ToInt32(dateTextBox.Text.Trim()); // QueryClass.InsertData(fs); MessageBox.Show("Add Successfully"); } catch (Exception ex) { MessageBox.Show("Error", ex.Message); } }