IIS - How to release dbc files

Topics: User Forum
Dec 1, 2014 at 10:07 AM
Hi friends!
I developed a VFP application for data sync through AVFP Website and my Local Application. I have 2 VFP application:
  • App for server: It is a daemon that run export operations every N minutes.
  • App for client: It is a stand alone application that downlaod exported data from server, import in the original database and export and upload everything (dbc and tables) on the server.
My application for server, if exist new data, overwrite all tables of my Website.

It isn't the best way but, for now, it's works...

My problem is that:

When my Server App run your operations, the copy fails because IIS have the dbc in use. However, i never use the dbc but only a single tables.

I've add in main.prg the "CLOSE DATA" but it can't resolve the problem.

P.S. Sorry for my error. I try to do my best...
Dec 1, 2014 at 5:24 PM
hmm, CLOSE DATA should work in main.prg, but I usually use it to close all free tables. Make sure the DBC is selected when you close data.

Here's a blurb I found on using CLOSE DATA in various scenarios:
If you have two open databases (DBCs), how many of them would you expect the CLOSE DATABASES command to close? If
your answer was "both of them," you're in for a surprise. CLOSE DATABASES works only on the "current" DBC (as shown in
the drop-down list on the VFP standard toolbar), closing the DBC and any associated tables and indexes. It doesn't touch
other DBCs and their tables, nor does it affect free tables. However, here's an exception: if there's no "current" DBC, then
CLOSE DATABASES will close all free tables instead (for compatibility with the behavior of earlier FoxPro releases). To close
more than one DBC, use CLOSE DATABASES ALL, or use SET DATABASE to make the appropriate DBC "current" before
Dec 2, 2014 at 3:44 PM
Following your solution, i've added into my main.prg CLOSE DATABASES ALL and later SET DATABASE TO mydatabase ; CLOSE DATABASES but with both methods the dbc file (that i don't use but it was called by dbf files) stay always in use.
I noticed that when i close my browser, IIS release the file but this isn't a solution for me because if another user is browsing my site, i can't sync...
Dec 3, 2014 at 9:26 PM
Weird, it should have nothing to do with the browser. Try the same thing from a browser on a computer different from the web server.
Dec 4, 2014 at 2:04 PM
I'm already visiting it with another computer. My website is on dedicate server and i visit it with my home computer. I don't understand what is the problem :(
Dec 4, 2014 at 6:18 PM
Maybe you should make sure this technique works with stand alone tables first (which I know it does). If it doesn't, then you're doing something wrong or the environment is not allowing it.

I've done this technique at GoDaddy with standalone dbfs several times and locally, successfully.
Dec 16, 2014 at 3:07 PM
Ok, "CLOSE DATA" works fine. The problem is mine because VFP puts the "SET EXCL ON" by default and this stop my update program.

Sorry and Thank you for your help!