once you set the datagridview properties to allowuser to add rows , update rows add a button to save your changes that have been done in the datagridview such as :
private void button1_Click(object sender, EventArgs e)
{
string connstr = "Data Source=************";
SqlConnection myconn = new SqlConnection(connstr);
myconn.Open();
foreach (DataGridViewRow dgRow in dataGridView1.Rows)
{
string Id = dgRow.Cells[0].Value.ToString();
int isEdit = Convert.ToInt32(dgRow.Cells[1].Value);
int isDelete = Convert.ToInt32(dgRow.Cells[2].Value);
int isADD = Convert.ToInt32(dgRow.Cells[3].Value);
string strQuery = "update Roles set CanEdit = '" + isEdit.ToString() + "', CanDelete='" + isDelete.ToString() + "', CanAdd='" + isADD.ToString() + "' where ID=" + Id;
SqlCommand cmdSelect = new SqlCommand(strQuery, myconn);
cmdSelect.ExecuteNonQuery();
}
myconn.Close();
}
hope this will help you ...
regards...