title: Fill in a datatable with data from database
body: <p>so here's what im tryng to do. I've got some data to fill a datatable from mysql database. As referred to sample projects, I've been extracting those details doing a SELECT query from an existing table(named examquestion). my query would be something like this:</p>
  
  <pre><code>SELECT * FROM entrancequestion
  WHERE Subject='Abstract Reasoning'
  ORDER BY RAND()
  LIMIT 10)
  
  UNION
  
  (SELECT * FROM entrancequestion
  WHERE Subject='English'
  ORDER BY RAND()
  LIMIT 30)
  
  UNION
  
  (SELECT * FROM entrancequestion
  WHERE Subject='Mathematics'
  ORDER BY RAND()
  LIMIT 30)
  
  UNION
  
  (SELECT * FROM entrancequestion
  WHERE Subject='Science'
  ORDER BY RAND()
  LIMIT 30 )
  </code></pre>
  
  <p>so all in all the datatable should be filled 100 rows total.</p>
  
  <p>my problem is actually inserting those data to a datatable</p>
  
  <p>first i read the data from the database</p>
  
  <pre><code>dim myqry as string    
  'where myqry as the codes above
  dim examdt as new datatable
  Dim conn As New SqlClient.SqlConnection("server=localhost;User Id=root;database=jnhsdb")
  
      Try
          conn.Open()
  
          Dim cmd As SqlCommand = New SqlCommand(myqry, conn)
          'create data reader
          Dim rdr As SqlDataReader = cmd.ExecuteReader
  
          'loop through result set
          rdr.Read()
  
          'now im lost on this part.
          'i want to insert the data into a data table. i got some code in mind but i think im doing it wrong.
  
  
  
  
          conn.Close()
      Catch ex As Exception
          MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
      End Try
  </code></pre>
  
  <p>so, how do you actually insert those data from a database to a datatable?</p>
  
  <p>follow up question:
  would it be possible to create a dataset from the datatable along with those queries?</p>