hi,
for (int i = 0; i < count; i++)
{
TextBox box3 = (TextBox)GridView2.Rows[i].Cells[3].FindControl("TextBox3");
TextBox box4 = (TextBox)GridView2.Rows[i].Cells[4].FindControl("TextBox4");
sc.Add(box3.Text + "," + box4.Text);
rowIndex++;
conn.Open();
string sqlStatement = "update SampleTable set Intime2='" + box3.Text + "',Outtime2='" + box4.Text + "' where ID='" + i+ "'";
SqlCommand cmd = new SqlCommand(sqlStatement, conn);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
conn.Close();
} .
or else bind the id to a label and fetch that and pass it to your query
Hope this helps