public bool save() { try { if (!validateentry()) { return(false); } Dictionary <String, Object> Params = new Dictionary <String, Object>(); Params.Add("customer_name", cboCustomer.Text); Params.Add("totalamount", totalinvoicev); Params.Add("terms", cboTerms.Text); Params.Add("clientname", cboclientname.SelectedValue); Params.Add("deldate", dtdelivered.Value.ToShortDateString()); Params.Add("dateprepared", dtprepared.Value.ToShortDateString()); Params.Add("datestamp", DateTime.Now.Date); Params.Add("delman", txtdelman.Text); string sql = DataSupport.GetInsert("global_NUD", Params); foreach (DataGridViewRow row in nudgrid.Rows) { if (row.IsNewRow) { continue; } Dictionary <String, Object> Param1 = new Dictionary <String, Object>(); Param1.Add("nudindex", "MAX(_nudindex)"); Param1.Add("invoice_no", row.Cells["invoice_no"].Value.ToString().Trim()); Param1.Add("invoice_date", row.Cells["invoice_date"].Value.ToString().Trim()); Param1.Add("amount", row.Cells["nudvalue"].Value.ToString().Trim()); Param1.Add("reason", row.Cells["reason"].Value.ToString().Trim()); Param1.Add("delstat", row.Cells["delstat"].Value.ToString().Trim()); Param1.Add("datestamp", DateTime.Now.Date); Param1.Add("paidby", row.Cells["account"].Value.ToString().Trim()); Param1.Add("sdrrno", row.Cells["sdrrno"].Value.ToString().Trim()); sql += DataSupport.GetInsertUsingSelect("global_NUDDetails", Param1, "global_nud"); } Utils.ExecuteNonQuery(sql, null); DevComponents.DotNetBar.MessageBoxEx.Show("Save Complete"); return(true); } catch (Exception ex) { DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message + " \n Please Report this to the programmer!"); return(false); } }