RE: TZF - Network Program ... try/finally

[email protected]
Newsgroups gmane.comp.lang.delphi.topaz
Message-ID <[email protected]>
    From: [email protected]
    To: [email protected]
    Sent: June 10, 2003 9:24 PM
    Subject: TZF - Network Program ... try/finally




    In developing a network program, I am trying to use
    a  "try/finally"  structure to allow the physical deletion
    of records (PACK).  I am getting a File Sharing error
    ( Error # 32 ) when I try to pack and there are two users
    in the system.  My Try/Finally looks like this:


        try   // this will create an exception if another user is using the
system
          DM.DBF_Courts.Active:=False;
          DM.DBF_Courts.Exclusive:=True;
          DM.DBF_Courts.Active:=True;
          DM.DBF_Courts.Pack;
        finally   // but I thought this would "clear" the exception
          DM.DBF_Courts.Active:=False;
          DM.DBF_Courts.Exclusive:=False;
          DM.DBF_Courts.Open;
        end;


    Thanks,
    Bob Watson
    Atlanta, GA
Bob,If the 2nd user has the table open and the datastate, in any state other
than Browse when the call is made to set Exclusive to True, the call will
fail and Exclusive will remain False. The ensuing call to Pack cannot then
be successful. Pack is a function that returnsa boolean value so the
following statement is valid. if not customer.Pack then ShowMessage('The
database cannot be Packed because other user has the file open.');Error 32
is a Topaz error and has nothing to do with the success of your try/finally
block. Also, the note on your code snipet says: "// this will create an
exception if another user is using the system" and "// but I thought this
would "clear" the exception"A try/finally block does not create an exception
but if an exception occurs within the try block and control is returned to
the block then always perform the clean up code in the finally portion.I
have never used Topaz's SetAutoHaltOff and SetAutoHaltOn before but perhaps
a solution to your problem is there.Why can you not just hide deleted
records and perform the pack operation at a time of your choosing when you
can verify that no other user is active in the table?Hope this helps lead
you to a solution.j wise

==^================================================================
This email was sent to: [email protected]

EASY UNSUBSCRIBE click here: http://topica.com/u/?clvXPN.a5kvff.Z2NsZHQt
Or send an email to: [email protected]

TOPICA - Start your own email discussion group. FREE!
http://www.topica.com/partner/tag02/create/index2.html
==^================================================================
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.