c# - multi-user MS Access Database- how to lock completely -
we have ms access database (accdb) out on our network, multiple users edit & read means of .net application. aware server db such sql server best choice situation, that's out of hands.
the .net application use both ado.net (ie oledbconnections
) , tools inside microsoft.office.interop.access.dao
namespace connect database.
i have read few articles , posts multiple users connecting access, , there seems confusion , differing opinions access's capabilities in regard. how/can achieve following in application:
- establish connections write database, lock entire database (all records , tables) until connection ended. if other users attempting write simultaneously halted exception, okay.
- establish connections designated read-only, have no conflicts other user's actions.
thanks.
to open accdb in exclusive mode need add key/value connection string
mode=share exclusive;
this block other user connect same database until close , dispose connection opens database in way.
if remember well, possible values (pretty self explanatory) mode keyword in jet connection string are
mode='read'; mode='write'; mode='readwrite'; mode='share deny none'; mode='share deny read'; mode='share deny write'; mode='share exclusive';
i have tried various combination of flags above, can't find simple solution allows single connection opened in readwrite while following connections fall read automatically. in scenario best path have local connection (not global one), try open in share exclusive
if need write database , catch exception if cannot open database giving user retry option. not easy path know. let's see if user better knowledge of ms-access give more elaborate solution.
i agree comment above (and own assesment) not best database tool use in situations of concurrency, things lot better now.
find this answer written, comprensive , balanced view of strength , weakness of access concurrency issues.
Comments
Post a Comment