به این شکل تغغیر دادم درست شد :
SqlConnection con = new SqlConnection("Data Source=.; Initial Catalog=Project; Integrated Security=TRUE ");
for (int i = 0; i < dataGridView3.RowCount-1; i++)
{
con.Open();
SqlCommand sc = new SqlCommand();
sc.Connection = con;
sc.CommandText = "update Personels set p_name='" + dataGridView3.Rows[i].Cells[1].Value + "' , p_family='" + dataGridView3.Rows[i].Cells[2].Value + "' where p_id=" + dataGridView3.Rows[i].Cells[0].Value;
sc.ExecuteNonQuery();
con.Close();
}
ممنون عزیزان.
-1 در حلقه رکورد خالی رو در نظر نمیگیره ، اگر دقت کنید 3 ردیف وجود داره.