SQL Server database table is :
inward_id, int(Primary Key),
gate_inward_done, varchar(50),
gate_entry_no, varchar(100),
gate_entry_date, date,
inward_date, date,
vendor_code, varchar(max),
vendor_name, varchar(max),
dc_no, varchar(max),
dc_date, date,
bill_received, varchar(max),
invoice_no, varchar(max),
invoice_date, date,
inv_total_amount, numeric(18,2),
gst_applicable, varchar(max),
cgst, numeric(18,2),
sgst, numeric(18,2),
igst, numeric(18,2),
inv_net_amount, numeric(18,2),
nu_freight, numeric(18,2),
fraction_amount, numeric(18,2),
approvar_department, varchar(max),
vc_remarks_master, varchar(max)
When I press button save in C# application, data is not saved in database and shows error "converting data varchar to numeric".
This is my code:
SqlCommand cmd1 = con.CreateCommand();
cmd1.CommandType = CommandType.Text;
cmd1.CommandText = "INSERT INTO inward_master values ('"+cmbGateEntry.Text+"','"+txtGateEntryNo.Text+"','"+dtpGateEntryDate.Value.ToString("yyyy-MM-dd")+"','"+dtpInwardDate.Value.ToString("yyyy-MM-dd")+"','"+cmbVendorCode.Text+"','"+txtVendorName.Text+"','"+txtDcNo.Text+"','"+dtpDcDate.Value.ToString("yyyy-MM-dd") +"','"+cmbbill_received.Text+"','"+txtInvoice_No.Text+"','"+dtpInvoiceDate.Value.ToString("yyyy-MM-dd") +"','"+ txtinv_total_amount.Text +"','"+cmbgst_applicable.Text+"','" + txtcgst.Text + "','" + txtsgst.Text + "','" + txtigst.Text + "','" + txtinv_net_amount.Text + "','" + txtnu_freight.Text + "', '" + txtfraction_amount.Text + "','"+cmbApproverDept.Text+"','"+txtvc_remarks_master.Text+"')";
cmd1.ExecuteNonQuery();}
Please give solution. Thanks in advance..