SqlDataAdapter da = new SqlDataAdapter("select * from emp", con);SqlCommandBuilder cb = new SqlCommandBuilder(da);DataSet ds = new DataSet();dataGridView1.DataSource = ds.Tables[0];da.UpdateCommand = cb.GetUpdateCommand();da.Update(ds);