title: Display SQL query result on VB form
body: <p>I am facing a problem displaying the result of my "select *" query on the form . Here is my code:</p>
  
  <pre><code>           Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As     System.EventArgs) Handles Button2.Click
  
      myconnection = New SqlConnection("server=PARTH-PC\SQLEXPRESS;uid=sa;pwd=parth;database=college")
  
      myconnection.Open()
      mycommand = New SqlCommand("SELECT * from [demo3]",myconnection)
      Dim mySqlDataAdapter As New SqlDataAdapter(mycommand)
      Dim mydsStudent As New DataSet()
  
      DataGridView2.DataSource = mydsStudent
      Me.Controls.Add(DataGridView2)
      ra = mycommand.ExecuteNonQuery()
      MessageBox.Show("Data displayed" &amp; ra)
  
      myconnection.Close()
  End Sub
  </code></pre>
  
  <p>But when I write this code and run my form I am not able to see any records present in my database tables being displayed on my form. I have inserted a DataGridView on my form . What changes should I do to my code ? Can Anyone help me ?</p>
  
  <p>Thanks in advance</p>