Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sample Code of Network Handling
Message
From
03/04/2005 03:11:16
Vinod Parwani
United Creations L.L.C.
Ad-Dulayl, Jordan
 
 
To
02/04/2005 09:40:09
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01000962
Message ID:
01001074
Views:
29
Thanks a lot for your reply, will refer this code as well the buffering article which you have suggested.


>>Can somebody pls provide some Sample Code of Handling dbf files in network i.e. code to open files, write files, delete records etc. in network.
>
>First, you have to SET EXCLUSIVE OFF.
>
>Next, you could use explicit record locking, but the modern and recommended approach is that you use buffering. Enable buffering on your tables - usually option 3 or 5 (optimistic record locking, or optimistic table locking). Sample commands, in a Form.Load():
>
>
>set exclusive off && this is required for shared access in a network
>set deleted on && nothing to do with network,
>               && but usually you would want to include this
>* Open tables
>use Table1 in 0 order Field1
>...
>* Buffering:
>CursorSetProp("Buffering", 5, "Table1")
>...
>
>
>Now, the user can do changes. To undo the changes:
>
>
>* Form.OnCancel() && method added by programmer
>TableRevert()
>
>
>And to save changes, your code might be similar to the following:
>
>
>* Form.OnSave() && method added by programmer
>select Table1
>if not TableUpdate() && if TableUpdate() failed
>  local laError(1)
>  aerror(laError)
>  MessageBox("Can't save the record, message #"  trans(laError(1);
>    + " Message: " + laError(2))
>endif
>
>
>Buffering is recommended, even if you don't use your program in a network.
Previous
Reply
Map
View

Click here to load this message in the networking platform