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"
|