Как я могу прочитать имена столбцов таблицы в combobox
I have a question. I need to have the rows of a table displayed as the list-elements of a combobox Actually I have a table called 'Table1' with two columns *Id* and *Name* and i need to have a combobox that once the form loads can read these column names as the elements of the combobox so if a search needs to be performed on the table, a choice can be done as per what column value. But when the form loads the combobox is empty Please find my code below:
Что я уже пробовал:
string sd = @"select * from AcquiredBulkInfo"; SqlConnection con = new SqlConnection(MyConnectionString); SqlCommand cmd = new SqlCommand(sd, con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); comboBox1.DataSource = dt;