Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DBC in DE opens in wrong dir.
Message
From
12/12/2000 18:16:22
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00451786
Message ID:
00452616
Views:
27
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
Previous
Reply
Map
View

Click here to load this message in the networking platform