title: Show databases of MySql server
body: <p>Does anybody know, how to show databases in C#? I know thats possible by executing a sql command <code>show databases</code>, but i dont know how to configure reader. Anybody please help me. </p>
  
  <p><strong>EDIT</strong>: I found a solution:</p>
  
  <pre><code>    private void Window_Loaded(object sender, RoutedEventArgs e)
      {
          MySqlConnection con = new MySqlConnection(this.constr);
          MySqlCommand cmd = con.CreateCommand();
          cmd.CommandText = "show databases";
          try
          {
              con.Open();
              MySqlDataReader reader = cmd.ExecuteReader();
              while (reader.Read())
              {
                  string row = "";
                  for (int i = 0; i &lt; reader.FieldCount; i++)
                      row += reader.GetValue(i).ToString();
                  listBox1.Items.Add(row);
              }
  
  
          }
          catch (MySqlException ex)
          {
              MessageBox.Show(ex.Number.ToString());
              MessageBox.Show(ex.Message);
          }
  
      }
  </code></pre>