title: How to pass DataTable from one class to the other class
body: <p>currently i'm studying MySQL, sorry for my newbie question. Here my question</p>
  
  <p>I have 2 class, the first one is Windows Form, and the other is just a class which I want contain all processes from SQL. here's my code in SQL Class</p>
  
  <pre><code>public void SampleQuery(string tablename)
      {
          DataTable dataTable;
  
          string query = "SELECT * FROM " + tablename;
  
          //Open connection
          if (this.OpenConnection() == true)
          {
              adapter = new MySqlDataAdapter(query,connection);
  
              dataTable =  new DataTable();
              adapter.Fill(dataTable);
  
              //close Connection
              this.CloseConnection();
              return;
          }
  </code></pre>
  
  <p>What I want to do is, show the data from SQL with DataGridView.
  Is it possible to code the datagridview in SQL Class above? or must be in Windows Form part?</p>
  
  <p>if must be in windows form, how to throw the dataTable which is now hold all the data to Windows Form class?</p>
  
  <p>thanks a lot for helping me. If my question sounds absurd just ask me.</p>