Reputation: 31
My problem is that I need to use a access database as a backend for my visual basic.net program.
The database will be accessed by a maximum of 10 users but I want to lock tables when a user is updating a record.
I am unable to use the SQL server at the company due to it storing sensitive information.
I have some basic knowledge of ado.net
I have read many articles but I can't find any articles that say how to lock a access .mdb file using Visual basic.net
I am aware that a SQL server is a better option but this is not possible option for me at the moment
Upvotes: 3
Views: 1983
Reputation: 44921
I suspect that your best bet is to add a "Locks" table which contains a record for each table in your database and a flag that indicates if the table is locked or not.
The calling methods would be responsible for checking this table prior to executing their code.
Because you will be working with individual records, the Access record locking mechanism should prevent simultaneous updates of a single record in this table, but if you get a lock, you should probably double-check it after obtaining it to ensure that it is valid.
Upvotes: 1