System.AccessViolationException when querying Access Database on Offices x64

0

I get the following error :

An unhandled exception of type 'System.AccessViolationException' occurred. Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Here is the code where the unhandled exception is thrown (ExecuteScalar) :

Public Shared Function RequeteScalarInteger(ByVal pConnectionBDD As OleDb.OleDbConnection, ByVal pStrSql As String) As Integer
    Dim retour As Object = -1
    Try
        Dim command As OleDbCommand = New OleDbCommand(pStrSql, pConnectionBDD)
        retour = command.ExecuteScalar() 'here is the unhandled error
        If IsNumeric(retour) Then
            retour = CInt(retour)
        ElseIf retour Is DBNull.Value Then
            retour = -1
        ElseIf retour = Nothing Then
            retour = 0
        Else
            retour = -1
        End If
        command = Nothing
    Catch ex As Exception
        retour = -1
        Debug.Write("RequeteScalarInteger:" & pStrSql)
        My.Application.Log.WriteEntry(Now & " - " & ex.Message & vbCrLf & ex.StackTrace & vbCrLf & pStrSql)
    End Try
    Return CInt(retour)
End Function

Here is the connection string :

"Provider=Microsoft.ACE.OLEDB.12.0;Data source=" & pPathBDD

And here is the Stack trace:

   at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
   at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
   at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
   at System.Data.OleDb.OleDbCommand.ExecuteScalar()
   at QuizzDll.Bdd.RequeteScalarInteger(OleDbConnection pConnectionBDD, String pStrSql) in C:\QuizzBox_Solution_Git\QuizzDll\modules\Bdd.vb:line 273
   at QuizzDll.Bdd.RequeteScalarInteger(String pStrSql) in C:\QuizzBox_Solution_Git\QuizzDll\modules\Bdd.vb:line 259
   at QuizzDll.Bdd.GetClePrimaire(String pStrNomTable) in C:\QuizzBox_Solution_Git\QuizzDll\modules\Bdd.vb:line 518
   at QuizzDll.ListePersonneSessionActive.Adapter_RowUpdated(Object sender, OleDbRowUpdatedEventArgs e) in C:\QuizzBox_Solution_Git\QuizzDll\Session\ListePersonneSessionActive.vb:line 1088
   at System.Data.OleDb.OleDbDataAdapter.OnRowUpdated(RowUpdatedEventArgs value)
   at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
   at QuizzDll.dsListePersonneFiltreTableAdapters.tPersonneTableAdapter.Update(tPersonneDataTable dataTable) in C:\QuizzBox_Solution_Git\QuizzDll\Datasets\dsListePersonneFiltre.Designer.vb:line 3209
   at QuizzDll.ListePersonneSessionActive.UpdateInBDD() in C:\QuizzBox_Solution_Git\QuizzDll\Session\ListePersonneSessionActive.vb:line 1070
   at QuizzDll.ListePersonneSessionActive.ListePersonneSessionActive_ListChanged(Object sender, ListChangedEventArgs e) in C:\QuizzBox_Solution_Git\QuizzDll\Session\ListePersonneSessionActive.vb:line 77
   at System.ComponentModel.ListChangedEventHandler.Invoke(Object sender, ListChangedEventArgs e)
   at System.ComponentModel.BindingList`1.OnListChanged(ListChangedEventArgs e)
   at System.ComponentModel.BindingList`1.InsertItem(Int32 index, T item)
   at QuizzDll.ListePersonneSessionActive.InsertItem(Int32 index, PersonneSessionActive item) in C:\QuizzBox_Solution_Git\QuizzDll\Session\ListePersonneSessionActive.vb:line 86
   at System.ComponentModel.BindingList`1.AddNewCore()
   at System.ComponentModel.BindingList`1.System.ComponentModel.IBindingList.AddNew()
   at System.Windows.Forms.CurrencyManager.AddNew()
   at Telerik.WinControls.Data.RadListSource`1.AddNew()
   at Telerik.WinControls.UI.GridViewNewRowInfo.EndAddNewRow()
   at Telerik.WinControls.UI.GridViewNewRowInfo.OnEndEdit()
   at Telerik.WinControls.UI.GridViewEditManager.FinishEditingOperation()
   at Telerik.WinControls.UI.GridViewEditManager.EndEdit()
   at Telerik.WinControls.UI.GridNewRowBehavior.ProcessEnterKey(KeyEventArgs keys)
   at Telerik.WinControls.UI.BaseGridBehavior.ProcessKey(KeyEventArgs keys)
   at Telerik.WinControls.UI.BaseGridEditor.OnKeyDown(KeyEventArgs keyEventArgs)
   at System.Windows.Forms.KeyEventHandler.Invoke(Object sender, KeyEventArgs e)
   at Telerik.WinControls.RadItem.OnKeyDown(KeyEventArgs e)
   at Telerik.WinControls.UI.RadTextBoxItem.TextBoxControl_KeyDown(Object sender, KeyEventArgs e)
   at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
   at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
   at System.Windows.Forms.Control.WmKeyChar(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.TextBox.WndProc(Message& m)
   at Telerik.WinControls.UI.HostedTextBoxBase.WndProc(Message& message)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at QB_Utilisateur.My.MyApplication.Main(String[] Args) in :line 81 ``` 

I have this problem only on x64 offices (in all versions 2010, 2013, 2016, 2019 and 365). Everythings works fine on x86 Offices.

My project is well set (x64 platform target) and uses framework 4.8.

I've tried to install AccessDatabaseEngine x64 (2010 and 2016) but i still have the issue.

I've tried the following solutions :

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

Attempted to read or write protected memory

...with no luck ...

in the event viewer i get the following :

Nom du module défaillant : ACECORE.DLL, version : 16.0.4654.1000, horodatage : 0x5a5f3614
Code d’exception : 0xc0000005
Décalage d’erreur : 0x0000000000067ffb
ID du processus défaillant : 0xe8
Heure de début de l’application défaillante : 0x01d65a8cfcdcdd12
Chemin d’accès de l’application défaillante : C:\Program Files\QuizzBox\QB_Utilisateur.exe
Chemin d’accès du module défaillant: C:\Program Files\Common Files\Microsoft Shared\OFFICE16\ACECORE.DLL
ID de rapport : 35a97517-1ba5-4c8f-89fc-7889842b375a
Nom complet du package défaillant : 
ID de l’application relative au package défaillant : 
XML de l’événement :
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Application Error" />
    <EventID Qualifiers="0">1000</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>100</Task>
    <Opcode>0</Opcode>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2020-07-15T09:48:18.1625753Z" />
    <EventRecordID>6015</EventRecordID>
    <Correlation />
    <Execution ProcessID="0" ThreadID="0" />
    <Channel>Application</Channel>
    <Computer>DESKTOP-FSPFO7H</Computer>
    <Security />
  </System>
  <EventData>
    <Data>QB_Utilisateur.exe</Data>
    <Data>6.2.1.0</Data>
    <Data>5ed6029f</Data>
    <Data>ACECORE.DLL</Data>
    <Data>16.0.4654.1000</Data>
    <Data>5a5f3614</Data>
    <Data>c0000005</Data>
    <Data>0000000000067ffb</Data>
    <Data>e8</Data>
    <Data>01d65a8cfcdcdd12</Data>
    <Data>C:\Program Files\QuizzBox\QB_Utilisateur.exe</Data>
    <Data>C:\Program Files\Common Files\Microsoft Shared\OFFICE16\ACECORE.DLL</Data>
    <Data>35a97517-1ba5-4c8f-89fc-7889842b375a</Data>
    <Data>
    </Data>
    <Data>
    </Data>
  </EventData>
</Event>
database
vb.net
64-bit
ms-jet-ace
asked on Stack Overflow Jul 16, 2020 by FlorianD • edited Jul 18, 2020 by Johnny Willemsen

1 Answer

0

I've been here and it's quite a nightmare. On some systems, you may have to use a newer provider, such as(note the 16): "Provider=Microsoft.ACE.OLEDB.16.0;Data source=" & pPathBDD

Something else to try, "Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=" & pPathBDD

answered on Stack Overflow Jul 16, 2020 by Jimmy Smith

User contributions licensed under CC BY-SA 3.0