TheVampire
Programmer
I'm getting an "Attempted to read or write protected memory" error when filling a DataTable. I've done a lot of checking into this error and tried many different things but cannot get it solved.
This error does not occur on my development system. It only occurs on the users system. Note that the user is running the program on MS Virtual Server 2005, so this may be the reason I do not see the problem. It may even be the reason that the error is occuring. I asked the user to set their page file size to "fixed" in VS but that had no effect.
In my code I have a class that is created to communicate through a COM port to an access control system and store data received from this system. The PC has several COM ports on it, all connected to different "sites" where access control systems are installed. As I loop through the sites I create the class, initialize it with the COM port #, the path for the database files for that site, and then connect. Once I am done with a site I destroy the class and then go on to the next site.
In the class I have a DataTable is being filled from an OleDbDataAdapter, using a SELECT command.
The first site I connect to and run through works fine with no errors. I can see in my progam log that the routine that fills the DataTable is executed many times without a problem, but the second site I connect to, the protected memory error occurs the first time I try to fill the DataTable with the results from the SELECT command.
It does not matter what order the sites are done in, the error always occurs on the second one.
The class uses IDisposable and is being disposed of correctly. I'm even forcing garbage collection with System.GC.Collect() before recreating the class.
Does anyone have any suggestions as to what else I might try?
This error does not occur on my development system. It only occurs on the users system. Note that the user is running the program on MS Virtual Server 2005, so this may be the reason I do not see the problem. It may even be the reason that the error is occuring. I asked the user to set their page file size to "fixed" in VS but that had no effect.
In my code I have a class that is created to communicate through a COM port to an access control system and store data received from this system. The PC has several COM ports on it, all connected to different "sites" where access control systems are installed. As I loop through the sites I create the class, initialize it with the COM port #, the path for the database files for that site, and then connect. Once I am done with a site I destroy the class and then go on to the next site.
In the class I have a DataTable is being filled from an OleDbDataAdapter, using a SELECT command.
The first site I connect to and run through works fine with no errors. I can see in my progam log that the routine that fills the DataTable is executed many times without a problem, but the second site I connect to, the protected memory error occurs the first time I try to fill the DataTable with the results from the SELECT command.
It does not matter what order the sites are done in, the error always occurs on the second one.
The class uses IDisposable and is being disposed of correctly. I'm even forcing garbage collection with System.GC.Collect() before recreating the class.
Does anyone have any suggestions as to what else I might try?