Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Views looking at workarea, not the 'live' directory tabl
Message
De
05/07/2002 15:41:52
 
 
À
05/07/2002 15:12:43
Angela Haws
Seminole County Tax Collector
Debary, Floride, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00675737
Message ID:
00675747
Vues:
12
I have some suggestions, but without more informaiton, I'm not sure which will work for you. How do you store the location of your database and views in your app? Do you have an app object or do you use the dataenvironment of forms? If you use the data environment of your forms, try setting SET DATABASE TO [LIVE DATABASE_NAME] in the BeforeOpenTables method to the live database and see if that works. It can be done in the base form class if you like. If you use an app object, is there a property of your app object that references the data location? Do you have a data location property or a before open tables method there? Do you use a framework or do you code in vanilla vfp?

Also, I found some code that I had that came originally from Doug Henig I think. Modify it when going live to match the live location of your database and place it in your dataenvironment beforeopentables method. It works very well too:
* dataenvironment.beforeopentables

* only needed if we are in the actual system
IF !(TYPE("OApp")=="O")
	RETURN
ENDIF
* Set the data directory
LOCAL lcPathSet, lnCount, lcDatabase
DO CASE
	CASE oApp.nPathSet = 1
		lcPathSet = "C:\My Documents\Data\"
	CASE oApp.nPathSet = 2
		lcPathSet = "Z:\My Documents\Data\"
	CASE oApp.nPathSet = 3
		lcPathSet = "E:\LiSA\"
	CASE oApp.nPathSet = 4
		lcPathSet = "G:\LiSA\"
ENDCASE
* Get list of members of the DataEnvironment
lnObjects = AMEMBERS(laObjects, THIS, 2)
* Look at each member object, but only process cursors.
FOR lnCount = 1 TO lnObjects
	loObject = EVALUATE('THIS.' + laObjects[lnCount])
	IF UPPER(loObject.BASECLASS) = 'CURSOR'
		lcDatabase = loObject.DATABASE
		* If this is a free table, we can leave it. Else....
		IF !EMPTY(lcDatabase)
			loObject.DATABASE = lcPathSet + SUBSTR(lcDatabase, RAT('\', lcDatabase) + 1)
		ENDIF EMPTY(lcDatabase)
	ENDIF UPPER(loObject.BASECLASS) = 'CURSOR'
NEXT lnCount
Tracy

>Hi all. I have been getting so frustrated because I have built 10 views based on tables contained within a .dbc in my test work area.
>
>Well come to find out when I run the .exe in another directory, it is using the tables from my workarea.
>Also, the views are also using these tables. (Not good...)
>
>How in the world, do I point the .exe to look at the tables in the .exe directory? Do I have to build the views all over? I can open the DATABASE and delete the table from there and add the new table (in the .exe directory) but the view is still based on (looking at) the table in my workarea.
>
>What has to be done to the views and tables within the 'live' directory, so that my grids work? The recordsource for the grids are the views built in my workarea....When I run the program in a different directory, I want the .dbc to point to the tables within that directory, and the views within the .dbc to use these tables as well.
>
>please help
>Angie
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform