0

That's my first post here, so please indicate me if there are some missing useful informations' to help to solve my problem.

Here is it:

I have a VB.net application using Access database (.mdb), which worked properly for years. Because I'm using now Access Database Engine 2016 in 64-bits, I have changed my DB connection provider from Microsoft.Jet.OLEDB.4.0 (only available in 32-bits) to Microsoft.ACE.OLEDB.12.0. I've also unchecked in my app's properties "32-bits prefered" (translation from my French version of Visual Studio).

Since I did these changes (and only them), I often get the following error:

System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

It appears (randomly) in different parts of the software, always at the line myConnection.Open()

Dim myConnection As OleDbConnection = New OleDbConnection(S7ConnString)
Try
myConnection.Open()
...

First new connection string with which I began to get this problem is:

Public S7ConnString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & DBPath & ";Jet OLEDB:Database Password=***;"   

(where DBPath is a string for the Access .mdb file path)

After some searches, I've read that adding OLE DB Services=-1 could solve it. It improved speed of DB processes really much, but did not solved the problem.

Would you have any idea to solve this?

Thank you & Kind regards.

Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
  • See that you have installed the 64-bit version of `Microsoft.ACE.OLEDB.12.0` or `Microsoft.ACE.OLEDB.16.0`. But you may not need the 64-bit version. The installed version of Office is not relevant if you just want to use an Access Database with the OleDb provider. Your app's bitness needs to match the provider's bitness. – Jimi Nov 27 '19 at 10:21
  • Remove `OLE DB Services=-1`. If you need to add details, edit your question. There's an `edit` link right below the question's body. Post the complete connection string: `DBPath` is unknown here. You need to post the actual value. You didn't specify whether the Access Database format is 2007-2016 or pre-2007. Also, if you have installed the `Access Database Engine 2016` (64-bit), the provider is `Microsoft.ACE.OLEDB.16.0`. – Jimi Nov 27 '19 at 10:41
  • Yes, but have you read my last comment? You have to post the *content* of `DBPath`, not describe what it is. + What 64bit provider have you installed? The 2010 or the 2016? If the latter, as already mentioned, the provider is `Microsoft.ACE.OLEDB.16.0`, not `Microsoft.ACE.OLEDB.12.0`. – Jimi Nov 27 '19 at 11:12
  • It is a bit messy. If you install ACE 16, you can and should still be able to use 12. – Albert D. Kallal Nov 27 '19 at 21:00

1 Answers1

0

I have uninstalled Access Database Engine 2016 and installed 2010 64-bits version, and it seems to work correctly now.

Thank you for your suggestions, @Jimi, that helped me to solve this. I did not imagine "Microsoft.ACE.OLEDB.12.0" provider was not compatible with MS Access Database Engine 2016!