I'm having a problem with filling a comboxcolumn
in a datagrid view. Here is a brief description of my problem.
I've a combo column in datagrid view named as dgvRightsColumn
and table in SQL named as Rights. I want to fill this combobox of dagaridview with the RightsNames in Rights Table.
DataGridViewComboBoxColumn dgvRightsColumn = new DataGridViewComboBoxColumn();
SqlCommand fillRights = new SqlCommand("SELECT * FROM [Rights]", sqlConnection);
SqlDataReader readerRights = fillRights.ExecuteReader();
while (readerRights.Read())
{
dgvRightsColumn.Items.Add(Convert.ToString(readerRights["RightName"]));
}
readerRights.Close();