Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement