dseaver
IS-IT--Management
- Jul 13, 2006
- 467
I am working creating a program in VS2005 which creates, populates and queries a Sql Server Compact Edition database. I am threading the sql queries and excel and Pdf generation so that the GUI doesn't lock up. I was debugging the functions for querying and report generation without threading the methods, but as soon as I moved the methods to a background worker, I started getting the following exception: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
When I populate the DB in a thread it works fine, but when I switch to a different thread and try to execute the exception when I run the fill method ("resultAdapt.Fill(resultTable);"). The methods worked fine when it wasn't threaded.
here is a partial stack trace
I tried googling the exception and found nothing that would fix the problem
When I populate the DB in a thread it works fine, but when I switch to a different thread and try to execute the exception when I run the fill method ("resultAdapt.Fill(resultTable);"). The methods worked fine when it wasn't threaded.
here is a partial stack trace
Code:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Data.SqlServerCe.NativeMethods.Move(IntPtr pSeCursor, DIRECTION direction, IntPtr pError)
at System.Data.SqlServerCe.SqlCeDataReader.Move(IntPtr pSeCursor, DIRECTION direction)
at System.Data.SqlServerCe.SqlCeDataReader.Move(DIRECTION direction)
at System.Data.SqlServerCe.SqlCeDataReader.Read()
at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)
at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
I tried googling the exception and found nothing that would fix the problem