title: How do I print SQL query using MessageBox in C#
body: <p>I am stuck with this problem since yesterday. I have created a button, which when clicked display the results from a SQL Server table. I thought of using <code>MessageBox</code> to print these results or if there is any other way to print results?</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      try
      {
          SqlConnection con = new SqlConnection("Data Source=FAREEDH;Initial Catalog=DeakinsTrade;Integrated Security=True");
          SqlCommand command = new SqlCommand("SELECT * FROM Products", con);
  
          con.Open();
  
          SqlDataReader reader = command.ExecuteReader();
          command.ExecuteNonQuery();
  
          con.Close();
      }
      catch (Exception es)
      {
          MessageBox.Show(es.Message);
      }
  }
  </code></pre>
  
  <p>I have tried different methods but it never worked.. I am really stuck. If you want more details, let me know. Thanks for the help in advance</p>