View Single Post
  #3 (permalink)  
Old April 7th, 2008, 09:30 AM
WestAussie WestAussie is offline
Registered User
 
Join Date: Apr 2008
Location: , , Australia.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Peter

Sorry, I should have included this originally.

  objConnection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0 ;Data Source=C:\MyDatabase.accdb;Persist Security Info=False;")


        'Initialize a new instance of the OleDbCommand class.
        objCommand = New OleDbCommand

        'Set command object properties.
        objCommand.CommandText = "qryMyAccessQuery"
        objCommand.CommandType = CommandType.StoredProcedure
        objCommand.Connection = objConnection

        'Initialize a new instance of the Adapter class.
        objDataAdapter = New OleDbDataAdapter

        'Initialize a new instance of the DataSet class.
        objDataSet = New DataSet

        'Set the SelectCommand for the DataAdapter.
        objDataAdapter.SelectCommand = objCommand

        'Populate the DataSet.
        objDataAdapter.Fill(objDataSet, "DataSet")

        Me.DataGridView.DataSource = objDataSet
        Me.DataGridView.DataMember = "DataSet"


Reply With Quote