Protected Function GetDataTableFromAccessDatabase(ConnectionString As String, SelectString As String) As Data.DataTable
Dim QueryResultsDataTable As New Data.DataTable
'To get the connection string: Server Explorer... Data Connections... Select an Access database... Press F4... Copy connection string to the clipboard.
Dim DataConnection As New OleDb.OleDbConnection
DataConnection.ConnectionString = ConnectionString
Dim OleCommand As New OleDb.OleDbCommand(SelectString, DataConnection)
Dim DataAdapter As New OleDb.OleDbDataAdapter(OleCommand)
DataAdapter.Fill(QueryResultsDataTable)
Return QueryResultsDataTable
End Function
Get table from Access database
Subscribe to:
Comments (Atom)