我得到以下错误:
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.
以下是引发未处理异常的代码(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
这是连接字符串:
"Provider=Microsoft.ACE.OLEDB.12.0;Data source=" & pPathBDD
这是堆栈跟踪:
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_GitQuizzDllmodulesBdd.vb:line 273
at QuizzDll.Bdd.RequeteScalarInteger(String pStrSql) in C:QuizzBox_Solution_GitQuizzDllmodulesBdd.vb:line 259
at QuizzDll.Bdd.GetClePrimaire(String pStrNomTable) in C:QuizzBox_Solution_GitQuizzDllmodulesBdd.vb:line 518
at QuizzDll.ListePersonneSessionActive.Adapter_RowUpdated(Object sender, OleDbRowUpdatedEventArgs e) in C:QuizzBox_Solution_GitQuizzDllSessionListePersonneSessionActive.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_GitQuizzDllDatasetsdsListePersonneFiltre.Designer.vb:line 3209
at QuizzDll.ListePersonneSessionActive.UpdateInBDD() in C:QuizzBox_Solution_GitQuizzDllSessionListePersonneSessionActive.vb:line 1070
at QuizzDll.ListePersonneSessionActive.ListePersonneSessionActive_ListChanged(Object sender, ListChangedEventArgs e) in C:QuizzBox_Solution_GitQuizzDllSessionListePersonneSessionActive.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_GitQuizzDllSessionListePersonneSessionActive.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 ```
我只在x64办公室上有这个问题(在2010、2013、2016、2019和365的所有版本中(。x86 Office上的一切都很好。
我的项目设置良好(x64平台目标(,使用框架4.8。
我已经尝试安装AccessDatabaseEngine x64(2010和2016(,但我仍然有问题。
我尝试了以下解决方案:
尝试读取或写入受保护的内存。这通常表明其他内存已损坏
尝试读取或写入受保护的内存
运气不好。。。
在事件查看器中,我得到以下内容:
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 FilesQuizzBoxQB_Utilisateur.exe
Chemin d’accès du module défaillant: C:Program FilesCommon FilesMicrosoft SharedOFFICE16ACECORE.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 FilesQuizzBoxQB_Utilisateur.exe</Data>
<Data>C:Program FilesCommon FilesMicrosoft SharedOFFICE16ACECORE.DLL</Data>
<Data>35a97517-1ba5-4c8f-89fc-7889842b375a</Data>
<Data>
</Data>
<Data>
</Data>
</EventData>
</Event>
我来过这里,真是一场噩梦。在某些系统上,您可能必须使用较新的提供程序,例如(注意16(:"Provider=Microsoft.ACE.OLEDB.16.0;Data source=" & pPathBDD
其他尝试,"Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=" & pPathBDD