Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checking if table in use
Message
 
To
10/10/2004 04:48:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00950216
Message ID:
00950245
Views:
11
>I don't want to get error message if the table used!

Use the Try-Catch in a method and return succes.


Something like
 PROCEDURE OpenExclusive(tcAlias as String) as Boolean
local llRetVal

llRetVal = .T.

if used(tcAlias)
    select (tcAlias)

else
    select 0

endif


TRY
    use (tcAlias) exclusive

CATCH
    *-- nope!
    llRetVal = .F.

ENDTRY

return llRetVal
ENDPROC
then You can call it
if OpenExclusive("Test")
   *-- do my exclusive stuff
else
   *-- display a message or do something different
endif
Oh, and if You do not Have VFP 8+ You'll need to do something like this instead of the try..catch
*-- disable the ErrorHandler
lcWasError = on("ERROR")
on ERROR *

....

use (tcAlias) exclusive

llRetVal = used(tcAlias)

*-- and reEnable the ErrorHandler
on error &lcWasError
HTH
Regards from Berlin

Frank

Dietrich Datentechnik (Berlin)
Softwarekombinat Teltow (Teltow)

Frank.Dietrich@dd-tech.de
DFPUG # 327
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform