title: How to call a query from MS Access 2010 (.accdb) within VB.Net 2010?
body: <p>I have this code that populates a datagridview with data from ms access:  </p>
  
  <pre><code>Dim con As New OleDbConnection  
  Dim ds As New DataSet  
  Dim da As OleDb.OleDbDataAdapter  
  Dim Sql As String
  
  Sql = "SELECT * FROM myTable WHERE case_no=?"  
  Try  
    con.ConnectionString = "PROVIDER=Microsoft.ACE.OLEDB.12.0;Data Source=Sample.accdb;Persist Security Info=True;Jet OLEDB:Database Password=dbadmin2010"  
      con.Open()  
      Dim cmd As OleDbCommand = New OleDbCommand(Sql, con)  
      da.SelectCommand = cmd  
      cmd.Parameters.AddWithValue("case_no", case_no)  
  
      Dim ds As DataSet = New DataSet  
      da.Fill(ds, "Case Info")  
      DataGridView1.DataSource = ds.Tables("Case Info")  
  
  Catch ex As Exception  
      MsgBox(ex.Message)  
  End Try
  </code></pre>
  
  <p>Now I had just finished creating a query from design view within MS Access itself, is there a way to call that query and retrieve the results to my datagridview?</p>