Solved

I get an error message when connecting to an access database

Posted on 2016-07-18
3
96 Views
Last Modified: 2016-08-02
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?
0
Comment
Question by:Moshe Singer
  • 2
3 Comments
 
LVL 26

Expert Comment

by:Nick67
ID: 41717672
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
0
 

Author Comment

by:Moshe Singer
ID: 41717804
I have the same situation if I use
Provider=Microsoft.Jet.OLEDB.4.0;
0
 
LVL 26

Accepted Solution

by:
Nick67 earned 500 total points
ID: 41717830
Perhaps it isn't MS Access violation!

Perhaps it is 'access violation' as in you don't have appropriate NTFS security on the file
Or something else that is causing a memory access violation.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now