Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27020

OleDB connection to Access2010 (*.accdb) filetype fails

$
0
0
Hi,

the code listed here works fine, and makes the connection to the mdb file.
Whenever I try to connect to an Access 2010 accdb-filetype, it fails.

How to solve this?

Code:

Imports System.Data.OleDb

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim connection As OleDbConnection
        connection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Alain\Documents\Access Databases\tryout.mdb;")
        Try
            connection.Open()
            MsgBox("Connection Open ! ")
        Catch ex As Exception
            MsgBox("Can not open connection ! ")
            End
        End Try
        Dim da As New OleDb.OleDbDataAdapter("select * from tabeltoestellen", connection)
        Dim ds As New DataSet
        da.Fill(ds)
        For i = 0 To ds.Tables(0).Rows.Count - 1
            CheckedListBox1.Items.Add(ds.Tables(0).Rows(i)(1))
        Next i
        connection.Close()
    End Sub
End Class


Viewing all articles
Browse latest Browse all 27020

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>