Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Network
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Divers
Thread ID:
00040519
Message ID:
00040669
Vues:
28
>Hi all,
>
>
>I'm trying to fit some extra network functionality to my program.
>I know it is standard implemented, but.....
>
>- the location of the tables should be variable
>(some user have a 'H-drive' others have an 'M-drive', ....)
>When you use the wizards then the location of the tables is stored in the environment. I've tried to change it via some code but .... it did'nt work.
>
>Any suggestions ??
>It's rather urgent
>Marc

Set the .AutoOpenTables property of the DataEnvironment for each form that has one to .F.. Many people change the path of the .Database property of each cursor in the DataEnvironment.BeforeOpenTables. Or you can do what I do and put this in your Form.Load (in your base class if you have one).

SET TALK OFF
oChangeDataPath = CREATEOBJECT('datafolder')
oForm = THISFORM
oChangeDataPath.curfolder(oForm)
RELEASE oChangeDataPath
RELEASE oForm

My code assums that the data is in the same folder with the app. Datafolder is a class with a method called curfolder, which goes like this:

PARA oFormcalled
* This class resets the paths of tables in the data environment
* to CURDIR()
IF PARAMETERS() = 0
RETURN
ENDIF
IF TYPE("oFormcalled.DataEnvironment") = "O"
oEnviron = oFormcalled.DataEnvironment
ELSE
RETURN
ENDIF
IF TYPE("oEnviron") = "O"
nTotMem = AMEMBERS(aMems,oEnviron,2)
WITH oEnviron
IF .AutoOpenTables = .F.
* Check for cursors
FOR i = 1 TO m.nTotMem
IF UPPER(EVAL("."+aMems[m.i]+".BaseClass")) = "CURSOR"
WITH EVAL("."+aMems[m.i])
STORE .Database TO cDB
cDB = SUBSTR(cDB,RAT('\',cDB)+1)
.Database = SUBSTR(FULLPATH(cDB),1,RAT('\',FULLPATH(cDB)))+cDB
ENDWITH
ENDIF
ENDFOR
.OpenTables()
ENDIF
ENDWITH
ENDIF
RELEASE oEnviron
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform