Vinoth Kumar

Vinoth Kumar

  • 1.3k
  • 450
  • 32.4k

System.Data.SqlClient.SqlException: Incorrect syntax near ',

Jun 23 2017 1:31 AM
con.Open();
SqlCommand cmd = new SqlCommand("insert into sales_return_entry" + "name,counter_name,customer_name,customer_categray,mobile_no,city,s_no,sales_man,design,barcode,item_name,rate,mtr,qty,amount,pdis,pdis_amount,cr_amount,less,net_amount,total_mtr,total_qty,total_pdis_amount,total_net_amount,bill_value,cash_card,cash_amount_card_no,s_mobile_no,card_amount,bill_dis,bill_less,round_off)value(@name,@counter_name,@customer_name,@customer_categray,@mobile_no,@city,@s_no,@sales_man,@design,@barcode,@item_name,@rate,@mtr,@qty,@amount,@pdis,@pdis_amoun,@cr_amount,@less,@net_amount,@total_mtr,@total_qty,@total_pdis_amount,@total_net_amount,@bill_value,@cash_card,@cash_amount_card_no,@s_mobile_no,@card_amount,@bill_dis,@bill_less,@round_off)",con);
cmd.Parameters.AddWithValue("@name", TextBox1.Text);
cmd.Parameters.AddWithValue("@counter_name", TextBox2.Text);
cmd.Parameters.AddWithValue("@customer_name", TextBox61.Text);
cmd.Parameters.AddWithValue("@customer_categray", TextBox62.Text);
cmd.Parameters.AddWithValue("@mobile_no", TextBox145.Text);
cmd.Parameters.AddWithValue("@city", TextBox146.Text);
cmd.Parameters.AddWithValue("@s_no", TextBox9.Text);
cmd.Parameters.AddWithValue("@sales_man", TextBox10.Text);
cmd.Parameters.AddWithValue("@design", TextBox11.Text);
cmd.Parameters.AddWithValue("@barcode", TextBox12.Text);
cmd.Parameters.AddWithValue("@item_name", TextBox13.Text);
cmd.Parameters.AddWithValue("@rate", TextBox14.Text);
cmd.Parameters.AddWithValue("@mtr", TextBox15.Text);
cmd.Parameters.AddWithValue("@qty", TextBox16.Text);
cmd.Parameters.AddWithValue("@amount", TextBox17.Text);
cmd.Parameters.AddWithValue("@pdis", TextBox18.Text);
cmd.Parameters.AddWithValue("@pdis_amount", TextBox19.Text);
cmd.Parameters.AddWithValue("@cr_amount", TextBox20.Text);
cmd.Parameters.AddWithValue("@less", TextBox21.Text);
cmd.Parameters.AddWithValue("@net_amount", TextBox135.Text);
cmd.Parameters.AddWithValue("@total_mtr", TextBox191.Text);
cmd.Parameters.AddWithValue("@total_qty", TextBox192.Text);
cmd.Parameters.AddWithValue("@total_pdis_amount", TextBox200.Text);
cmd.Parameters.AddWithValue("@total_net_amount", TextBox203.Text);
cmd.Parameters.AddWithValue("@bill_value", Label201.Text);
cmd.Parameters.AddWithValue("@cash_card", TextBox193.Text);
cmd.Parameters.AddWithValue("@cash_amount_card_no", TextBox194.Text);
cmd.Parameters.AddWithValue("@s_mobile_no", TextBox195.Text);
cmd.Parameters.AddWithValue("@card_amount", TextBox196.Text);
cmd.Parameters.AddWithValue("@bill_dis", TextBox199.Text);
cmd.Parameters.AddWithValue("@bill_less", TextBox202.Text);
cmd.Parameters.AddWithValue("@round_off", TextBox204.Text);
cmd.ExecuteNonQuery();
con.Close();
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Done')", true);
 
 This is my coding. run time showing error: System.Data.SqlClient.SqlException: Incorrect syntax near ','
 
what is my problem 

Answers (2)