General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
DataEnvironment using hard-coded database path
My VFP 6 app uses containers and dbfs, no remote data sources. In my ini, I can point to different directories for dev, testing or production. My app reads the ini, determines where to point and then opens the requested database.
PROBLEM
In any form's data environment, the cursor seems to be mapped to the DEVELOPMENT dbc. So, even though I OPEN DATA N:\MYAPP\DATA\MYDBC.dbc early on in the app, all forms seem to open cursors off my development dbc (C:\MYAPP\DATA\MYDBC.dbc).
A workaround I found was to change the DataEnvironment.Cursor?.Database in the form's DE BeforeOpenTables event:
This.Cursor1.Database = goapp.cPathNet + [Data\MyApp.dbc]
But this seems rather painful. You have to do it for EVERY table that is opened in EVERY DE. There is no DE inheritance so I cannot put it in my base form class (I hear 7.0 does this). And there is no SetAll() type method to apply such a change to ALL cursors of a DE.
This being such a classic situation (development, testing, production paths), there MUST be an obvious way that I'm missing.
Thanks
Henry
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only