title: C# MySQL query result Visual Studio
body: <pre><code>public ArrayList P2a(string sql)
  {
      ArrayList result = new ArrayList();
  
      MySqlCommand cmd = new MySqlCommand();
      MySqlConnection mysqlconnection = new MySqlConnection(xxx);
      cmd.Connection = mysqlconnection;
      cmd.CommandText = sql;
      try
      {
          cmd.Connection.Open();
          MySqlDataReader reader = cmd.ExecuteReader();
          while (reader.Read())
          {
              Dictionary&lt;string, object&gt; dict = new Dictionary&lt;string, object&gt;();
              for (int count = 0; (count &lt;= (reader.FieldCount - 1)); count++)
              {
                  dict.Add(reader.GetName(count), reader[count]);
              }
                  result.Add(dict);
          }
  
          return result;
      } catch {
          return result;
      } finally {
          cmd.Connection.Close();
      }
  }
  </code></pre>
  
  <p>C# Visual Studio 2017 MySQL void return echo problem.</p>
  
  <p>I want to make sure that I print out the result properly.</p>
  
  <p>Example:</p>
  
  <pre><code>ArrayList query = P2a("select id,site,comment from sites");
  
  MessageBox.Show(query[0]["site"].toString());
  </code></pre>
  
  <p>To use it this way.</p>
  
  <p>Can you make the necessary corrections in the function?</p>