LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Write Failure at 5400 Records, DBDeactivate/DBActivate Map

I created a short routine to copy records from one database to another.  Essentially it is a loop

 

while (records)

{

    ReadRecords()

    WriteRecords (DBCreateRecords(), DBPutRecord())

}

 

I use mapping (BeginMap, ActivateMap, Deactivate Map, etc)

 

The system fails (Gen. Protection Fault) at 5400 records.  Every time.  I can fix it by using:

 

while (records)

{

   DBActivateMap()

   ReadRecords()

    WriteRecords()

   DBDeactivateMap()

}

 

My question is why?  This does not make intuitive sense.  Once the map is on place and points to the correct variables, why would you have to do it over and over.

 

Thanks in advance, David

 

 

0 Kudos
Message 1 of 3
(2,744 Views)

Hey Diverdke,

 

I haven't found any information about known issues with an error on the mapping functions in CVI. Would it be possible to see a bit more of your code to get a better idea of what operations are being performed every time?

 

I'd also be curious to know what your computer's memory usage looks like during this operation. If you open the Task Manager and watch the Performance tab while your code runs, do you see the memory usage climb as the code runs?

 

Hopefully we can get to the bottom of this--it's very strange that it always tops out at 5400 records.

0 Kudos
Message 2 of 3
(2,729 Views)

Found another solution.  The problem was (MS Access database) that as the table grow very large (> 1M records), the write times became long.  This slowed down the software.  I started archiving the records to another database to reduce the table size.   This is was I was using the copy routine for.

 

However, I have found that just creating a new table that is empty allows the code to keep running efficiently.  This is very quick do to in SQL Toolkit (DBCreateTableFromMap()).

 

Thanks for the help on this. I have attached the code (long....) just in case you want to look.  Look for the routine (ArchiveDBRecords())

 

David

0 Kudos
Message 3 of 3
(2,725 Views)