If I have the following table:
canAssign
------------
1
Is there a way to add the column header text (e.g., canAssign, etc.) to the CheckedListBox as the labels that a user can check?
All answers I've found list the value as the labels, like this:
ā 1
Instead of this:
ā canAssign
For Example Only, If I'm using the following to list whatever value is in the canAssign column, how could I change this to list the 'canAssign' column header text?
string myString = "SELECT canAssign FROM Permissions";
using (SqlConnection myConn = new SqlConnection(globalConnectionString))
{
try {
myConn.Open();
using (SqlCommand myComm = new SqlCommand(myString, myConn))
{
SqlDataReader myReader = myComm.ExecuteReader();
while (myReader.Read()) {
checkedListBox1.Items.Add(myReader["canAssign"]);
}
}
} catch (Exception ex) {
MessageBox.Show(ex.Message);
}
}