Discussion:
Close Database - VFP 9 - Changed
(too old to reply)
devendra
2005-07-30 01:51:10 UTC
Permalink
There is a change in Close database function in VFP9.

Once, a database is opened in a form, it can be closed only when a form is
closed. This major change has been indicated only by way of note in help
topic of Close Database.

Is not fair for MS to document every change that is made from earlier
version at a place where one can find it easily ? It helps the developer to
know what is changed and he can assess its implications.

This changed has ruined my all developments hitherto made. For my general
accounting application, different company can be selected in one form. What
I am doing on selecting on new company, I close old databse and open databse
from new directoy. It is working very fine till VFP 9. Now as in VFP 9 due
to chnage in Close Database behavior, as old databse cannot be closed,
requerrying is not properly functioning and giving very odd results.

Is there is any workaround to close database in a form ?

And one question arises in my mind that If a database cannot be closed in a
form, what is the use of close databse function ? Database is always closed
when a form is released. Moreover what prompted VFP team to change this
behavior ?

Thanks in advance.

Devendra
Fred Taylor
2005-07-30 02:20:35 UTC
Permalink
What are you talking about? CLOSE DATA closes the current database just
fine, same as it always has. I see no such note in Help about being unable
to CLOSE DATABASE from within a form.
--
Fred
Microsoft Visual FoxPro MVP
Post by devendra
There is a change in Close database function in VFP9.
Once, a database is opened in a form, it can be closed only when a form is
closed. This major change has been indicated only by way of note in help
topic of Close Database.
Is not fair for MS to document every change that is made from earlier
version at a place where one can find it easily ? It helps the developer to
know what is changed and he can assess its implications.
This changed has ruined my all developments hitherto made. For my general
accounting application, different company can be selected in one form. What
I am doing on selecting on new company, I close old databse and open databse
from new directoy. It is working very fine till VFP 9. Now as in VFP 9 due
to chnage in Close Database behavior, as old databse cannot be closed,
requerrying is not properly functioning and giving very odd results.
Is there is any workaround to close database in a form ?
And one question arises in my mind that If a database cannot be closed in a
form, what is the use of close databse function ? Database is always closed
when a form is released. Moreover what prompted VFP team to change this
behavior ?
Thanks in advance.
Devendra
devendra
2005-07-31 00:07:01 UTC
Permalink
The note in Close Database function is as below.

Using CLOSE DATABASES in the Command window does not close a database if the
database was opened in the Project Manager by expanding its node or when a
form is running in its own data session. Under these circumstances, the
database remains open until the Project Manager closes the database or until
the form using the database closes.

You can verify also by just Set Step On, Close Database and Set in a Form.

Devendra
Post by Fred Taylor
What are you talking about? CLOSE DATA closes the current database just
fine, same as it always has. I see no such note in Help about being unable
to CLOSE DATABASE from within a form.
--
Fred
Microsoft Visual FoxPro MVP
Post by devendra
There is a change in Close database function in VFP9.
Once, a database is opened in a form, it can be closed only when a form is
closed. This major change has been indicated only by way of note in help
topic of Close Database.
Is not fair for MS to document every change that is made from earlier
version at a place where one can find it easily ? It helps the developer to
know what is changed and he can assess its implications.
This changed has ruined my all developments hitherto made. For my general
accounting application, different company can be selected in one form. What
I am doing on selecting on new company, I close old databse and open databse
from new directoy. It is working very fine till VFP 9. Now as in VFP 9 due
to chnage in Close Database behavior, as old databse cannot be closed,
requerrying is not properly functioning and giving very odd results.
Is there is any workaround to close database in a form ?
And one question arises in my mind that If a database cannot be closed
in
Post by Fred Taylor
Post by devendra
a
form, what is the use of close databse function ? Database is always closed
when a form is released. Moreover what prompted VFP team to change this
behavior ?
Thanks in advance.
Devendra
Fred Taylor
2005-07-31 19:17:38 UTC
Permalink
So what's your problem then? Is the database open in the Project Manager?
--
Fred
Microsoft Visual FoxPro MVP
Post by devendra
The note in Close Database function is as below.
Using CLOSE DATABASES in the Command window does not close a database if the
database was opened in the Project Manager by expanding its node or when a
form is running in its own data session. Under these circumstances, the
database remains open until the Project Manager closes the database or until
the form using the database closes.
You can verify also by just Set Step On, Close Database and Set in a Form.
Devendra
Post by Fred Taylor
What are you talking about? CLOSE DATA closes the current database just
fine, same as it always has. I see no such note in Help about being
unable
Post by Fred Taylor
to CLOSE DATABASE from within a form.
--
Fred
Microsoft Visual FoxPro MVP
Post by devendra
There is a change in Close database function in VFP9.
Once, a database is opened in a form, it can be closed only when a form
is
Post by Fred Taylor
Post by devendra
closed. This major change has been indicated only by way of note in help
topic of Close Database.
Is not fair for MS to document every change that is made from earlier
version at a place where one can find it easily ? It helps the
developer
to
know what is changed and he can assess its implications.
This changed has ruined my all developments hitherto made. For my
general
Post by Fred Taylor
Post by devendra
accounting application, different company can be selected in one form. What
I am doing on selecting on new company, I close old databse and open databse
from new directoy. It is working very fine till VFP 9. Now as in VFP 9
due
Post by Fred Taylor
Post by devendra
to chnage in Close Database behavior, as old databse cannot be closed,
requerrying is not properly functioning and giving very odd results.
Is there is any workaround to close database in a form ?
And one question arises in my mind that If a database cannot be closed
in
Post by Fred Taylor
Post by devendra
a
form, what is the use of close databse function ? Database is always closed
when a form is released. Moreover what prompted VFP team to change this
behavior ?
Thanks in advance.
Devendra
devendra
2005-08-01 00:34:52 UTC
Permalink
No. In EXE while running application.

Devdndra
Post by Fred Taylor
So what's your problem then? Is the database open in the Project Manager?
--
Fred
Microsoft Visual FoxPro MVP
Post by devendra
The note in Close Database function is as below.
Using CLOSE DATABASES in the Command window does not close a database if the
database was opened in the Project Manager by expanding its node or when a
form is running in its own data session. Under these circumstances, the
database remains open until the Project Manager closes the database or until
the form using the database closes.
You can verify also by just Set Step On, Close Database and Set in a Form.
Devendra
Post by Fred Taylor
What are you talking about? CLOSE DATA closes the current database just
fine, same as it always has. I see no such note in Help about being
unable
Post by Fred Taylor
to CLOSE DATABASE from within a form.
--
Fred
Microsoft Visual FoxPro MVP
Post by devendra
There is a change in Close database function in VFP9.
Once, a database is opened in a form, it can be closed only when a form
is
Post by Fred Taylor
Post by devendra
closed. This major change has been indicated only by way of note in help
topic of Close Database.
Is not fair for MS to document every change that is made from earlier
version at a place where one can find it easily ? It helps the
developer
to
know what is changed and he can assess its implications.
This changed has ruined my all developments hitherto made. For my
general
Post by Fred Taylor
Post by devendra
accounting application, different company can be selected in one
form.
Post by Fred Taylor
Post by devendra
Post by Fred Taylor
Post by devendra
What
I am doing on selecting on new company, I close old databse and open databse
from new directoy. It is working very fine till VFP 9. Now as in VFP 9
due
Post by Fred Taylor
Post by devendra
to chnage in Close Database behavior, as old databse cannot be closed,
requerrying is not properly functioning and giving very odd results.
Is there is any workaround to close database in a form ?
And one question arises in my mind that If a database cannot be closed
in
Post by Fred Taylor
Post by devendra
a
form, what is the use of close databse function ? Database is always closed
when a form is released. Moreover what prompted VFP team to change this
behavior ?
Thanks in advance.
Devendra
Fred Taylor
2005-08-01 01:17:12 UTC
Permalink
Nothing about CLOSE DATABASE has changed that I'm aware of. Only the help
file was changed to better reflect what it actually does.
--
Fred
Microsoft Visual FoxPro MVP
Post by devendra
No. In EXE while running application.
Devdndra
Post by Fred Taylor
So what's your problem then? Is the database open in the Project Manager?
--
Fred
Microsoft Visual FoxPro MVP
Post by devendra
The note in Close Database function is as below.
Using CLOSE DATABASES in the Command window does not close a database
if
the
database was opened in the Project Manager by expanding its node or
when
a
Post by Fred Taylor
Post by devendra
form is running in its own data session. Under these circumstances, the
database remains open until the Project Manager closes the database or until
the form using the database closes.
You can verify also by just Set Step On, Close Database and Set in a
Form.
Post by Fred Taylor
Post by devendra
Devendra
Post by Fred Taylor
What are you talking about? CLOSE DATA closes the current database
just
Post by Fred Taylor
Post by devendra
Post by Fred Taylor
fine, same as it always has. I see no such note in Help about being
unable
Post by Fred Taylor
to CLOSE DATABASE from within a form.
--
Fred
Microsoft Visual FoxPro MVP
Post by devendra
There is a change in Close database function in VFP9.
Once, a database is opened in a form, it can be closed only when a
form
Post by Fred Taylor
Post by devendra
is
Post by Fred Taylor
Post by devendra
closed. This major change has been indicated only by way of note in help
topic of Close Database.
Is not fair for MS to document every change that is made from earlier
version at a place where one can find it easily ? It helps the
developer
to
know what is changed and he can assess its implications.
This changed has ruined my all developments hitherto made. For my
general
Post by Fred Taylor
Post by devendra
accounting application, different company can be selected in one
form.
Post by Fred Taylor
Post by devendra
Post by Fred Taylor
Post by devendra
What
I am doing on selecting on new company, I close old databse and open databse
from new directoy. It is working very fine till VFP 9. Now as in VFP
9
Post by Fred Taylor
Post by devendra
due
Post by Fred Taylor
Post by devendra
to chnage in Close Database behavior, as old databse cannot be
closed,
Post by Fred Taylor
Post by devendra
Post by Fred Taylor
Post by devendra
requerrying is not properly functioning and giving very odd results.
Is there is any workaround to close database in a form ?
And one question arises in my mind that If a database cannot be
closed
Post by Fred Taylor
Post by devendra
in
Post by Fred Taylor
Post by devendra
a
form, what is the use of close databse function ? Database is always closed
when a form is released. Moreover what prompted VFP team to change this
behavior ?
Thanks in advance.
Devendra
Cindy Winegarden
2005-07-30 05:41:27 UTC
Permalink
Hi Devendra,

Are you perhaps referring to this from the Close All topic?
Note:
Using CLOSE DATABASES in the Command window does not close a database if the
database was opened in the Project Manager by expanding its node or when a
form is running in its own data session. Under these circumstances, the
database remains open until the Project Manager closes the database or until
the form using the database closes.
<<

Are you testing in the Fox development environment or when running from an
EXE?
--
Cindy Winegarden MCSD, Microsoft Visual Foxpro MVP
***@msn.com www.cindywinegarden.com
Blog: http://spaces.msn.com/members/cindywinegarden
Post by devendra
There is a change in Close database function in VFP9.
Once, a database is opened in a form, it can be closed only when a form is
closed. This major change has been indicated only by way of note in help
topic of Close Database.
Is not fair for MS to document every change that is made from earlier
version at a place where one can find it easily ? It helps the developer to
know what is changed and he can assess its implications.
This changed has ruined my all developments hitherto made. For my general
accounting application, different company can be selected in one form. What
I am doing on selecting on new company, I close old databse and open databse
from new directoy. It is working very fine till VFP 9. Now as in VFP 9 due
to chnage in Close Database behavior, as old databse cannot be closed,
requerrying is not properly functioning and giving very odd results.
Is there is any workaround to close database in a form ?
And one question arises in my mind that If a database cannot be closed in a
form, what is the use of close databse function ? Database is always closed
when a form is released. Moreover what prompted VFP team to change this
behavior ?
Thanks in advance.
Devendra
devendra
2005-07-31 00:06:28 UTC
Permalink
Yes. The same Note.

I am testing in the development environment.

Is there any different behaviour for development and Running EXE
environment.
Post by Cindy Winegarden
Hi Devendra,
Are you perhaps referring to this from the Close All topic?
Using CLOSE DATABASES in the Command window does not close a database if the
database was opened in the Project Manager by expanding its node or when a
form is running in its own data session. Under these circumstances, the
database remains open until the Project Manager closes the database or until
the form using the database closes.
<<
Are you testing in the Fox development environment or when running from an
EXE?
--
Cindy Winegarden MCSD, Microsoft Visual Foxpro MVP
Blog: http://spaces.msn.com/members/cindywinegarden
Post by devendra
There is a change in Close database function in VFP9.
Once, a database is opened in a form, it can be closed only when a form is
closed. This major change has been indicated only by way of note in help
topic of Close Database.
Is not fair for MS to document every change that is made from earlier
version at a place where one can find it easily ? It helps the developer to
know what is changed and he can assess its implications.
This changed has ruined my all developments hitherto made. For my general
accounting application, different company can be selected in one form. What
I am doing on selecting on new company, I close old databse and open databse
from new directoy. It is working very fine till VFP 9. Now as in VFP 9 due
to chnage in Close Database behavior, as old databse cannot be closed,
requerrying is not properly functioning and giving very odd results.
Is there is any workaround to close database in a form ?
And one question arises in my mind that If a database cannot be closed
in
Post by Cindy Winegarden
Post by devendra
a
form, what is the use of close databse function ? Database is always closed
when a form is released. Moreover what prompted VFP team to change this
behavior ?
Thanks in advance.
Devendra
Stefan Wuebbe
2005-07-31 08:19:41 UTC
Permalink
Post by devendra
Yes. The same Note.
I am testing in the development environment.
Is there any different behaviour for development and Running EXE
environment.
No, as Fred and Cindy pointed out, the behavior of the "Close
Databases" command did not change, only the online help text
was improved.


-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
devendra
2005-08-01 00:33:49 UTC
Permalink
Does it mean that Close Database behaviour is the same as that of VFP 8 ?
Devendra
Post by Stefan Wuebbe
Post by devendra
Yes. The same Note.
I am testing in the development environment.
Is there any different behaviour for development and Running EXE
environment.
No, as Fred and Cindy pointed out, the behavior of the "Close
Databases" command did not change, only the online help text
was improved.
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
Stefan Wuebbe
2005-08-01 15:06:05 UTC
Permalink
Post by devendra
Does it mean that Close Database behaviour is the same as that of VFP 8 ?
Devendra
Yes, I think so too. The particular effect that you cannot close a
database being opened by another instance, like private datasessions
at runtime or the project manager in the IDE, did not change since
VFP5 at least.


hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
devendra
2005-08-01 23:33:31 UTC
Permalink
Yes. I have checked. In VFP 8 also, the same behavior.

But now If I want close dtabase in form, how can I close it ?

Devendra
Post by Stefan Wuebbe
Post by devendra
Does it mean that Close Database behaviour is the same as that of VFP 8 ?
Devendra
Yes, I think so too. The particular effect that you cannot close a
database being opened by another instance, like private datasessions
at runtime or the project manager in the IDE, did not change since
VFP5 at least.
hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
Stefan Wuebbe
2005-08-02 05:20:03 UTC
Permalink
Post by devendra
Yes. I have checked. In VFP 8 also, the same behavior.
But now If I want close dtabase in form, how can I close it ?
How does your scenario look like? Assumed it requires closing
databases to try to do some maintenance stuff, running only every
other month, a typical approach would be to "CloseAllForms()"
of the current instance beforehand, e.g.

Proc CloseAllForms() && pseudo code
Local lnForm
For lnForm = _screen.FormCount To 1 Step -1
_screen.Forms(m.lnForm).Release()
EndFor
Return ( _screen.FormCount = 0 )
EndProc



hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
devendra
2005-08-02 23:48:59 UTC
Permalink
It means that Database cannot be closed from a form.

If a form is not running, no user interface would be available while closing
databse.

Devdndra
Post by Stefan Wuebbe
Post by devendra
Yes. I have checked. In VFP 8 also, the same behavior.
But now If I want close dtabase in form, how can I close it ?
How does your scenario look like? Assumed it requires closing
databases to try to do some maintenance stuff, running only every
other month, a typical approach would be to "CloseAllForms()"
of the current instance beforehand, e.g.
Proc CloseAllForms() && pseudo code
Local lnForm
For lnForm = _screen.FormCount To 1 Step -1
_screen.Forms(m.lnForm).Release()
EndFor
Return ( _screen.FormCount = 0 )
EndProc
hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
Stefan Wuebbe
2005-08-03 06:56:02 UTC
Permalink
Post by devendra
It means that Database cannot be closed from a form.
If a form is not running, no user interface would be available while closing
databse.
Not necessarily, there are probably a lot of ways -
you can for example modify the sample code from the previous
posting to exclude the current form.Name.

Or run the code in a menu procedure right before you instantiate the
maintenanceForm.

Or have a custom "Form Manager" object, which can be useful
anyway, keeping track of all instances of your dataForm class,
e.g. in oDataForm.Init() register by sending a reference.to
oFormManager.to be stored in a oFormManager.customCollection
and unregister in oDataForm.Destroy()
That way you can tell your form manager to try to release all
dataForms etc.


hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
devendra
2005-08-04 23:50:01 UTC
Permalink
Thanks for reply.

Devendra
Post by Stefan Wuebbe
Post by devendra
It means that Database cannot be closed from a form.
If a form is not running, no user interface would be available while closing
databse.
Not necessarily, there are probably a lot of ways -
you can for example modify the sample code from the previous
posting to exclude the current form.Name.
Or run the code in a menu procedure right before you instantiate the
maintenanceForm.
Or have a custom "Form Manager" object, which can be useful
anyway, keeping track of all instances of your dataForm class,
e.g. in oDataForm.Init() register by sending a reference.to
oFormManager.to be stored in a oFormManager.customCollection
and unregister in oDataForm.Destroy()
That way you can tell your form manager to try to release all
dataForms etc.
hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
Anders
2005-09-13 16:48:53 UTC
Permalink
If the Project Manager is holding the database open, select the database on
the Data tab of the PM and use the Close button on the same page to close
it. The only thing hghat's new here is that the Help spells it out.
-Anders
Post by devendra
Yes. I have checked. In VFP 8 also, the same behavior.
But now If I want close dtabase in form, how can I close it ?
Devendra
Post by Stefan Wuebbe
Post by devendra
Does it mean that Close Database behaviour is the same as that of VFP 8
?
Post by Stefan Wuebbe
Post by devendra
Devendra
Yes, I think so too. The particular effect that you cannot close a
database being opened by another instance, like private datasessions
at runtime or the project manager in the IDE, did not change since
VFP5 at least.
hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
Loading...