Allow only 1 user at a time to modify Access DB.

VB.Net 2005, Access 2000

I have a VB.Net App that uses an Access Database. There are a handful of users for this application. I need them to all be able to view the data from the database (via datagridview), but only one user at a time should be allowed to modify data in the database. There is not a login for this app, so I would like to set it up so the first user in would have modify rights. How can I accomplish this?

Who is Participating?
Jeff CertainConnect With a Mentor Commented:
Two options.
1. Add "Exclusive = 1" to your connection string. The OLEDB connection string looks like "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Exclusive=1;Uid=admin;Pwd=;"

 (Here's a great resource for connection strings:
2. Change the Access file to use exclusive locks by default.
David L. HansenConnect With a Mentor Programmer AnalystCommented:
David L. HansenProgrammer AnalystCommented:
Notice in the link I provided you can set the exclusive property in a simple desktop shorcut.
coperations07Author Commented:
Thanks guys! I'm going to go with the exclusive locks option. There are several connection strings in the application code, so I'd rather not get into that unless I have to.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.