Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CLOSE DATABASES ALL does not close a database
Message
 
 
À
18/04/2001 17:40:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00497036
Message ID:
00497051
Vues:
13
This message has been marked as the solution to the initial question of the thread.
While SET DATABASE is scoped to the data session, the actual database is only opened ONCE regardless of how many forms with private DSs are open.

One of the only times you should close the database is in your application SHUTDOWN procedure [before your app quits].

The only way CLOSE DATABASES ALL will work is if you first close all forms that have a private DS or at least have had their database deselected [i.e., SET DATABASE TO].

>Hello, All
>
>Do you know why the command CLOSE DATABASES ALL does not close the current database?
>
>After some messages here in the UT, I was convinced to switch to Private DataSession. But, as you surely know, the SET DATABASE is scoped to the current datasession. So, to not be forced to issue every time the command SET DATABASE TO some_database, I've created a property in the global app object, where I've stored the name of the current database. Also, the property have an ASSIGN method, with the following code:
>
>
>LPARAMETERS vNewVal
>IF ALLTRIM(vNewVal) == ""
>	SET DATABASE TO ""
>ELSE
>	IF DBUSED(vNewVal)
>		SET DATABASE TO (vNewVal)
>	ELSE
>		OPEN DATABASE (vNewVal)
>	ENDIF
>ENDIF
>THIS.DATABASE = DBC()
>RETURN vNewVal
>
>
>Thus, every time I've store something in the property, this method will try to set the database or to open it.
>
>In the .Load event of my form base class, I have the following line of code:
>
>
>SET DATABASE TO (oApp.DATABASE)
>
>
>------------------------------------
>
>These are all the different things as I've worked before. But at this moment, if I issue the CLOSE DATABASES ALL command everywhere in the form, the current database doesn't close. It becomes unselected, but not closed.
>
>Can somebody enlighten?
>
>Thank you
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform