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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deleting DBF files

Status
Not open for further replies.

blumash

Programmer
Oct 2, 2003
50
0
0
HU
I run a screen where I need a temporary DBF file ,I create this file during the run of the screen by :

CREATE dbf &user (prdcat c(15), amount n(4), supdat d(8), prcperun n(10))

In some stage of the program I don't need anymore this file & I delete it by :

delete file &user.dbf

for some reason I don't receive any error massage , the file was not deleted , he is still there & I can't find out what's the problem , why is the file not being deleted.

Thank's
 
The . tells the macro to stop processing. If you've got "Test" in the variable user then the command is coming out as [TT]DELETE FILE Testdbf[/TT].

You need two periods. Try this to see what I mean:
Code:
user = "Test"
USE &user.dbf      && Error message "Can't find file Testdbf"
USE &user..dbf     && Test.Dbf opens

Geoff Franklin
 
You might have more reliable results if you used fully-pathed macro substitution variables such as:

Code:
mcStartUp = SYS(5) + SYS(2003)
mcDBF = mcStartUp + "\Temp\User.dbf"

CREATE DBF (mcDBF) (prdcat c(15),;
                 amount n(4),;
                 supdat d(8),;
                 prcperun n(10))

<Do Whatever>

SELECT User
USE
ERASE (mcDBF)
* If you have created an Index on the DBF, don't forget to erase the CDX file as well.

One side note: I find that in a multi-user environment it works best if I have all of my Temp files created on the local workstation rather on the server (default drive/directory) so that there is no conflict/over-write from other concurrent users.

Good Luck,


JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
Sounds like you could create a cursor which will automatically be deleted when you exit foxpro.

instead of create dbf try this:

create cursor user blah blah blah

you can use them like a dbf if you include readwrite at the end also.

 
Thank's guy's , I silved the problem , the advice of alvechurchdata was helpfull , in the delete file..... I put 2 dots instead of 1.

Thank's again
 
Also, you don't have to use macrosubstitution. Here is faster equivalent code:
Code:
DELETE FILE (user+".dbf")
dbMark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top