Dear Mr.Harvey,
Where do I put the functions you described.
I open 20 + data files at beginning of the program and others elsewhere.
You should open all your dbf files in shared mode. You can use the functions provided by Mr.Rick to open the DBF files in shared mode
For Eg:
Assuming that you have 2 DBF files namely Customer.Dbf and Invoice.Dbf
Instead of executing the regular xBase command to open the Dbf
For eg:
Select 1
Use Customer
Select 2
Use Invoice
You should open the Dbf in shared mode using the Function NetUse() (the second parameter should be .F.)
- Code: Select all Expand view
select 1
if netuse( "Customer.dbf", .f.,5 ) // database, .t. for exclusive lock, .f. for shared, 5 for time-out
else
return(.f.)
endif
Select 2
if netuse( "Invoice.dbf", .f.,5 ) // database, .t. for exclusive lock, .f. for shared, 5 for time-out
else
return(.f.)
endif
Are the functions a one time call for each file or a many time call where are initialized?
Once you have opened a DBF in shared mode, it remains shared till you close the DBF.
Once you have opened a DBF in shared mode, you should also make use of the Functions Addrec() and RecLock()
ie Whenever you try to add a new record to the DBF opened in shared mode, instead of Append Blank you should use Addrec()
Whenever you try to edit a record, before you start editing, you should lock the record using the Function RecLock()
Regards
Anser