Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to change dataenvironment class without losing curso
Message
From
24/07/2003 03:38:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
23/07/2003 22:27:28
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00812995
Message ID:
00813021
Views:
7
>An app runs from the directory of the currently selected company. During design, however, files in dataenvironment are in a different directory.
>
>1) To get around problem I plan to change the path of files in dataenvironment in the BeforeOpenTables event. This could be done in each form's BeforeOpenTables method or better in a dataenvironment class, and then setting DEClass and DEClassLib in the form class. Unfortunately, setting DEClass loses the content of all my forms dataenvironment. Is there a way to change DEClass and yet save the work defining dataenvironments?
>
>2) Is there a better way to solve the original problem?
>
>------------ some time later ----------
>I tried do hack form and change dataenvirionment class, but found that once that is done you can't add cursors to form, so that approach is out.
>
>And the solution is... add the following method, which does the work, to form class and make a call to the new method from dataenvironment's beforeopentables().
>
>
>LOCAL laMembers[1],lnObjects,loCursor
>lnObjects = AMEMBERS(laMembers,This.DataEnvironment,2)
>FOR i = 1 TO lnObjects
>	loCursor = EVALUATE('This.Dataenvironment.' + laMembers[i])
>	IF UPPER(loCursor.Baseclass) = 'CURSOR'
>		loCursor.CursorSource = JustFName(loCursor.CursorSource)
>	ENDIF
>ENDFOR
>
Alejandro,
Instead just rename original data folder to something else and use 'set path'.
ie: Dataenvironment has 'c:\development\data\myData.dbc' as database path.
If you rename 'c:\development\data' to say ''c:\development\datax' and set path to data folder you want to use, VFP uses tables from your set('path').
PS: And this is version independant.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform