How to check if someone connected to a Access DB
how can I check in my programm if someone working on a microsoft access db? Its only allowed that 1 User works on the database with my programm (C#), so I need a way to check this because access is not so good for multiple Users开发者_如何学运维.
thanks
Read up on Exclusive Mode in MS-Access.
http://support.microsoft.com/kb/209207
http://social.msdn.microsoft.com/forums/en-US/adodotnetdataproviders/thread/c90b1166-e5ee-43ff-a49b-9efe9f416475/
Ok:
- There's no reason why access will not be fine with multiple users - however its performance over a network can be a poor and there are better alternatives.
- If its open there will be a .ldb file - however this may not be the best way to check as it should disappear if the connection is closed and therefore you could easily things up so that there are "strange" concurrent user issues - further, as suggested in the comments, its not reliable (although if it is there and the db is closed you've got bigger problems).
- @Tim has the first solution right in terms of looking at Exclusive Mode
- I'd probably also suggest putting your own "lock" file in place rather than relying on any mechanisms in access
- And if the only reason you want to restrict connections to the file is concerns with concurrent access then you seriously need to review whether you are using the right tools.
精彩评论