telmessos
08-29-2010, 06:59 PM
Hi all,
I am using the following code to load the databases on MySQL to a ComboBox. But the combobox shows also the default databases like information_schema, mysql and test databases. I would like to exclude these databases from the list.
Could you please tell me how I can exclude certain databases?
Thanks
telmessos
string sql = "Show databases";
MySqlDataAdapter adapter = new MySqlDataAdapter();
MySqlCommand command = new MySqlCommand();
command.CommandText = sql;
command.Connection = connection;
adapter.SelectCommand = command;
DataTable dtListe = new DataTable();
adapter.Fill(dtListe);
connection.Close();
comboBox1.DataSource = dtListe;
comboBox1.DisplayMember = "DATABASE";
comboBox1.ValueMember = "DATABASE";
I am using the following code to load the databases on MySQL to a ComboBox. But the combobox shows also the default databases like information_schema, mysql and test databases. I would like to exclude these databases from the list.
Could you please tell me how I can exclude certain databases?
Thanks
telmessos
string sql = "Show databases";
MySqlDataAdapter adapter = new MySqlDataAdapter();
MySqlCommand command = new MySqlCommand();
command.CommandText = sql;
command.Connection = connection;
adapter.SelectCommand = command;
DataTable dtListe = new DataTable();
adapter.Fill(dtListe);
connection.Close();
comboBox1.DataSource = dtListe;
comboBox1.DisplayMember = "DATABASE";
comboBox1.ValueMember = "DATABASE";