Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database does not close 1

Status
Not open for further replies.

mkendi

Programmer
Oct 21, 2000
82
TR
In my program there is a section, where the user can delete all index-tags, re-create the indexes and pack the database.
But with the command "PACK DATABASE" I get the error message, that the database is not opened exclusivly.
With the debugger I could see, that indeed the command CLOSE DATABASES or CLOSE DATABASES ALL did not close the database. Only the command CLOSE ALL does it, but this also closes the project-manager etc.
Where is my fault?

Thanks in advance
MK
 
Before closing the database, select the database-

set databse to <Open database name>
Close database

Regds,
Pankaj


Senior Software Engineer,
Infotech Enterprises Limited
Hyderabad, Andhra Pradesh, India.
URL :
 
Hi

It appears that you are running that code in a development environment, because you say that the project manager also gets closed.

CLOSE ALL will close all projects open, and all the designers such as forms and views as well along with all databases in all data sessions.

CLOSE ALL DATABASES will close all database open in the current data session. However, you should be aware that VFP also opens the databases, not necessarily in the default data session, but that could be its own private data session. That is the circumstance, when you try to recompile the project, often you get the error, some class is open somewhere or such conditional errors, which vanish once you close and open a project. The point is that these errors will come only under a development environment, where as in a run-time situation, you have complete control of the data session you open and so can close the tables suitably.

In short, you are not doing anything wrong.. but the users packing the tables or recreating the indexes, be better tested in a run-time environment without the development version of VFP on for accuracy.

SET DATABASES TO
* To ensure that all free tables are also closed.
CLOSE TABLES ALL
CLOSE DATABASES ALL

This will take care of run-time situatiion.

In a development environment, this will work correct most of the time.. if the DATA tab of the project manager is not the visible one. If the data tab is open, then there are chances that VFP by default opens the database or some of its tables. So changing to another tab and then issuing the code.. CLOSE DATABASES ALL closes the open tables. This info is faced by me in realisty. I never bothered to go deep into it, since I know to work around by changing the tab when I need, as a secnd nature.

:)



:)



____________________________________________
ramani - (Subramanian.G) :)
 
Ramini,
Thank you very much for this detailed informations. I was fooling around since months with this problem.
Thanks again
MK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top