qty,total cost gridview column not insert database

Apr 20 2016 8:07 AM
protected void btnSubmit_Click(object sender, EventArgs e)
{
foreach (GridViewRow g1 in GridView1.Rows)
{
SqlConnection con = new SqlConnection(ConStr);
SqlCommand com = new SqlCommand("insert into tblTotal(Product_Name,MRP,Salon_Cost,Qty,Total_Cost) values ('" + g1.Cells[0].Text + "','" + g1.Cells[1].Text + "','" + g1.Cells[2].Text + "','" + g1.Cells[3].Text+ "','" + g1.Cells[4].Text + "')", con);
con.Open();
com.ExecuteNonQuery();
con.Close();
}
}
 
 
this my code. the quantity and total cost enter the run time using jquery but the two column values not insert the database 

Answers (29)