-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
Description
Hi all,
we get a AccessViolationException when using System.Data.OleDb with "Microsoft OLE DB Provider for Visual FoxPro 9.0" (vfpoledb) after inserting a new row with a DataTable and OleDbDataAdapter.Update().
ExceptionDetails:
StackTrace: null
Data: {System.Collections.ListDictionaryInternal}
HResult: -2147467261
HelpLink: null
InnerException: null
Message: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Source: null
TargetSite: null
Fatal error. 0xC0000005
at System.Data.Common.UnsafeNativeMethods+ICommandWithParameters.SetParameterInfo(IntPtr, IntPtr[], System.Data.OleDb.tagDBPARAMBINDINFO[])
at System.Data.OleDb.OleDbCommand.ApplyParameterBindings(ICommandWithParameters, System.Data.OleDb.tagDBPARAMBINDINFO[])
at System.Data.OleDb.OleDbCommand.CreateAccessor()
at System.Data.OleDb.OleDbCommand.InitializeCommand(System.Data.CommandBehavior, Boolean)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(System.Data.CommandBehavior, System.Object ByRef)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(System.Data.CommandBehavior, System.String)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at System.Data.Common.DbDataAdapter.UpdateRowExecute(System.Data.Common.RowUpdatedEventArgs, System.Data.IDbCommand, System.Data.StatementType)
at System.Data.Common.DbDataAdapter.Update(System.Data.DataRow[], System.Data.Common.DataTableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(System.Data.DataTable, System.Data.Common.DataTableMapping)
at System.Data.Common.DbDataAdapter.Update(System.Data.DataTable)
at OleDBTest.Program.Main(System.String[])
associated Code:
using (OleDbConnection oledbConn = new OleDbConnection(@"Provider=vfpoledb;Data Source=d:\temp\dbfile.dbf;Collating Sequence = machine;")) {
oledbConn.Open();
using (OleDbDataAdapter da = new OleDbDataAdapter($"select * from dbfile.dbf", oledbConn)) {
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
da.InsertCommand = cb.GetInsertCommand();
DataTable dt = new DataTable();
da.Fill(dt);
var customerRow = dt.NewRow();
//Fill columns
dt.Rows.Add(customerRow);
da.Update(dt); // <-- the AccessViolationException is thrown here
}
}We ported the code from classic .Net Framework (4.8) where the code works without a problem.
Reactions are currently unavailable