Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DBC in DE opens in wrong dir.
Message
De
12/12/2000 18:16:22
George Obergfell
Peak Software Systems
Sandy, Utah, États-Unis
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00451786
Message ID:
00452616
Vues:
29
Mark,

After digging more on MSDN's site, found this (Article ID: Q128996). Replace the DATA_PATH with the path you want for your dbc.



* Paste this code into your form's DataEnvironment.BeforeOpenTables() method and it will switch the DBC's path to the local path...
DATA_PATH=FULLPATH('')

* Make a list of all the cursors in the Data Environment
AMEMBERS(A_Cursors,THISFORM.DATAENVIRONMENT,1)
ASORT(A_Cursors, 2)
nStartpos=ASUBSCRIPT(A_Cursors, ASCAN(A_Cursors, "Object"),1)
FOR I = nStartpos TO ALEN(A_Cursors,1)
IF A_Cursors(I,2) = "Object"
cObjClass = "THISFORM.DATAENVIRONMENT."+A_Cursors(I,1)+".class"
IF EVAL(cObjClass)="Cursor"
cObjName="THISFORM.DATAENVIRONMENT." ;
+ A_Cursors(I,1)+".DATABASE"

* Display the Object name...
*WAIT WINDOW cObjName
Data_Name=EVAL(cObjName)

* Display the Old Pathing
*WAIT WINDOW "This is Data_Name : "+ Data_Name

* Modify the path to the database
NewDataPath=ALLTRIM(DATA_PATH) ;
+ ALLTRIM(SUBSTR(Data_Name, RAT("\",Data_Name)+1))

* Display the New Pathing
*WAIT WINDOW NewDataPath

* Evaluate the cursor object
oRef = EVAL( "THISFORM.DATAENVIRONMENT."+A_Cursors(I,1) )

*Modify the Database property with the new path
oRef.DATABASE = NewDataPath
ENDIF
ELSE
EXIT
ENDIF
ENDFOR
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform