Connecting to MDB file on x64 platform
-
Thursday, May 10, 2012 1:00 AM
Hi
In my ado.net/vb.net app how can I connect to an MDB file on Win 7 x64 platform? Would appreciate a short code example.
Thanks
Regards
All Replies
-
Thursday, May 10, 2012 1:30 PM
Below is a simple example. Note that the Platform option (Build...Configuration Manager...) must be set to x86. This will force the app to run 32-bit in order to support the Jet OLEDB Provider (which is 32-bit only). If you want to run 64-bit then you would have to use the ACE OLEDB Provider.
Dim ConnectionString As String ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Test Files\db1 XP.mdb" Dim AccessConnection As New System.Data.OleDb.OleDbConnection(ConnectionString) AccessConnection.Open() Dim da As New System.Data.OleDb.OleDbDataAdapter("SELECT * FROM [Products]", AccessConnection) Dim ds As New DataSet da.Fill(ds, "Products") DataGridView1.DataSource = ds.Tables("Products")
Paul ~~~~ Microsoft MVP (Visual Basic)
- Edited by Paul P Clement IVMVP Thursday, May 10, 2012 1:31 PM
- Marked As Answer by Y a h y a Thursday, May 10, 2012 2:17 PM

