protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow g1 in GridView1.Rows)
{
string connStr = ConfigurationManager.ConnectionStrings["demoConStr"].ConnectionString;
SqlConnection con = new SqlConnection(connStr);
com = new SqlCommand("Insert into prodata (ID,sl,cpoints,spec,actual,remark,status,fil) Values ('" + txtsystemid.Text + "','" + g1.Cells[0].Text + "','" + g1.Cells[1].Text + "','" + ((TextBox)g1.Cells[2].FindControl("txtspecbind")).Text + "','" + ((TextBox)g1.Cells[3].FindControl("txtactbind")).Text + "','" + ((TextBox)g1.Cells[4].FindControl("txtrembind")).Text + "','" + ((DropDownList)g1.Cells[5].FindControl("checkbind")).Text + "','" + 0 + "' )", con);
con.Open();
com.ExecuteNonQuery();
con.Close();
}
lblm.Text = "Records inserted successfully";
}
This code for Gridview Data Entry..
I need Update Query... Please solve my problem..