I have two VC++ 6 apps writing/updating data in a common Access 2000 database – both apps are downloading information from different dataloggers.
Every so often we get an exception when trying to do an add/edit/update:
(3260) Could not update; currently
locked by user ‘admin’ on machine
‘abc123’.
I am confident that the problem is related to record locking in the database.
We’re using CDaoRecordset to access the data. From reading docs it appears that the default is to optimistically lock the database page that the record is in. If another process tries to edit/update a record in the same page they get the error we’re seeing.
Moving to SQL Server isn’t an option at this point – it’s not a simple change because of how things are structured.
I’m wondering if I can make the records in the affected tables large enough so that only one record fits into each 2k data page. If I make each record 1100 bytes long then each record should get its own page, solving the locking problem. I know it will use up more disk space however that is not a problem at the moment as the affected tables are pretty low volume ones.
Would that work? Can a record in Access 2000 be split across two pages?
Bloating records just to avoid a locking conflict is not a very practical method. For one thing, Access databases are limited to 2 Gb. That includes system tables. I suggest you trap the error and try the action again. Not knowing C++, I can’t give you the code to do that but I assume you already know how to do that.