|
-
Nov 6th, 2000, 08:37 AM
#1
Thread Starter
Lively Member
Hey
Is it possible to kick all users and open the database exclusive (the users are already using the database)? The problem is this :
If / when the database gets corrupt some of the users can still continue to work on while others can't logon at all. If there is such a function it would be nice to be able to kick all users and repair it and the re-open it, is it possible at all ? ?
//Patrick
-
Nov 6th, 2000, 08:42 AM
#2
Frenzied Member
It's naughty but if you delete the .LDB file in the same directory as the .MDB file you'll find nobody is locking the database any more...
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Nov 6th, 2000, 08:48 AM
#3
Thread Starter
Lively Member
THAT is Naughty
but unfortunatly it doesn't work, if you try removing it windows give you a file error. The file is already in use by someone else (alas you can't delete it). This ain't because someone is using it RIGHT now, windows always gives you this error.....
//Patrick
-
Nov 6th, 2000, 10:06 AM
#4
Addicted Member
As far as I know they're is no easy way of doing this.
First of all you have to know what users are in the mdb. So you problably have to do something with a login screen and keep track of who is logged in.
I use a 'user-table' for this in which all users are stored and a flag is set to True if the user logs in.
With this table, I can see who is logged into the app (and the database(s) it is using). If I want to kick someone out, I let the application put a small, hidden file with name <userid> in the datadirectory. I let the application check every 30 seconds for a file called <userid>. If found, I let the app display a message that there session will be closed in a minute. After that minute the app disconnects all connections from there instance of the App to the database, removes the <userid> file, sets the login flag in the usertable to false and shuts itself down.
I use the same trick with a hidden file in the datadirectory to lock an application for database maintenance or whatever.
I'm sure there must be better ways, but this works fine for me.
Regards,
Laurens
Using VB5 Enterprise edition SP3
VB6 Enterprise edition SP5
-
Nov 6th, 2000, 03:34 PM
#5
Thread Starter
Lively Member
how about a single user?
Is it possbile then (from access or vb) to exclude (kick) a user (if you know that he's in the database and you know his id) if he's currently accessing access? Or must you exit your application ?
(sorry for posting new thread - pressed the wrong button 
//Patrick
-
Nov 6th, 2000, 03:52 PM
#6
Lively Member
I don't think it'll be possible to disconnect users from the database from VB. In my opinion, you should use Operating System's tools, to discover who is connected to the mdb and then disconnect them.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|