Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table Users

Status
Not open for further replies.

SercoSteve

Programmer
Sep 25, 2002
44
GB
Is is possible to programmatically find out which users are accessing a particular table and if required remove there access programmatically so that the work can be carried out on the table?

At present we have to phone around all the users and ask them to exit the table of interest.
 
You can use enumLocks()to find out what users have placed a lock an a particular table but I don't think there is any way to programmable remove them from the table. You could write a program that would find out what users are using the table and send them a message asking them to close the table, this would be fairly simple to do using something such as windows messaging "Net Send Username "message"".

What is the process you need to do to the table? Perhaps there is another option that doesn't require full table access.

Perrin
 
I have not done this yet but the answer is Yes. User the Enumlocks record to create a table that will show you what locks are on the table and who has them. You will also want to set Exclusive locks on the table when you are running your routine.

From the Object Pal help:

enumLocks ( const tableName String ) LongInt

enumLocks creates a Corel Paradox table specified by tableName that lists the number of locks on the specified table. If tableName already exists, this method overwrites it without asking for confirmation. If tableName is open, this method fails. For dBASE tables, this method lists only the lock you’ve placed (not all locks currently on the table). You can also include an alias or path in tableName; if an alias or path is not specified, Corel Paradox creates tableName in the working directory.

lock ( const lockType String ) Logical

Description

lock places locks on the TCursor. The lockType argument is one of the following String values, listed in order of decreasing strength and increasing concurrency.

 
Thanks for your responses guys.

The emunLocks is great, and Kliot if all else fails we'll send the users a message asking them to leave the form accessing the table, thanks.

'htcs' not sure what you're trying to explain after your emunLocks entry, there maybe something missing from the end of your post?

Thanks Again

Steve
 
Yes, part of the post got cut off. You need to check for what kind of lock you can place on the table before you start the routine. LockStatus() can tell you that. Then you need to place a exclusive lock on the table or tcursor when you run the routine. SetExclusive() can do that for you. Place code into the method that errors out if the lock cannot be placed.

Hope this helps

James D. Howard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top