Avatar of Moshe Singer
Moshe Singer
Flag for United States of America asked on

I get an error message when connecting to an access database

In vb.net, 2015- when I connect to an access database, with the following code:

Dim StnStr() As String
        StnStr = "Data Source=servername; Initial Catalog=databasename; User ID=userid; Password=password"
        StnStr = "Provider=MSDataShape;Data Provider=Microsoft.Jet.OLEDB.4.0;"
        StnStr = StnStr & "Jet OLEDB:System database=" & My.Application.Info.DirectoryPath & "\System.mdw;"
        StnStr = StnStr & "Password=PW;User ID=USERNAME;"
        StnStr = StnStr & "Data Source=" & My.Application.Info.DirectoryPath & "\data.mdb;"
        StnStr = StnStr & "Persist Security Info=False"

 Dim CON As New OleDb.OleDbConnection(StnStr)
       CON.Open()


I receive the following error message in the output window:

The program '[3660] UpdateCrgs.vshost.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.
What can this mean?
In other projects it seems fine, why in this project am I getting this message?
Microsoft AccessMicrosoft ApplicationsVisual Basic Classic

Avatar of undefined
Last Comment
Nick67

8/22/2022 - Mon
Nick67

I'm a thinkin' this is a little hatched

StnStr = "Provider=MSDataShape;Data Provider=Microsoft.Jet.OLEDB.4.0;"
https://msdn.microsoft.com/en-us/library/ms254500(v=vs.110).aspx

Are you sure that the MSDataShape provider is in use with an .mdb data source?
And are you sure you want to carry on with that, as it seems that MS is deprecating it?
https://msdn.microsoft.com/en-us/library/ms676105(v=vs.85).aspx
Moshe Singer

ASKER
I have the same situation if I use
Provider=Microsoft.Jet.OLEDB.4.0;
ASKER CERTIFIED SOLUTION
Nick67

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck