Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Drop free table
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01121605
Message ID:
01121680
Views:
8
>>>>hi all,
>>>>
>>>>is there away to drop free table if found
>>>>as
>>>>
>>>>locate for aa.dbf
>>>> if found()
>>>>   drop table aa
>>>>else
>>>>  mesagebox("not found")
>>>>endif
>>>>
>>>>thanks
>>>
>>>
>>>m.PathToFile = "c:\yourdir\"
>>>lcSearchFile = m.PathToFile+"aa.dbf" &&& example lcSearchFile = c:\yourdir\aa.dbf
>>>IF FILE(m.lcSearchFile)
>>>   DELETE FILE(m.lcSearchFile)
>>>ELSE
>>>   MESSAGEBOX("Not Found")
>>>ENDIF
>>>
>>
>>Don't forget about the CDX and FPT files as well. You can either code them specificly
>>
>>m.PathToFile = "c:\yourdir\"
>>lcSearchFile = m.PathToFile+"aa" &&& example lcSearchFile = c:\yourdir\aa.dbf
>>IF FILE(m.lcSearchFile+".dbf")
>>   DELETE FILE(m.lcSearchFile+".dbf")
>>   IF FILE(m.lcSearchFile+".cdx")
>>      DELETE FILE(m.lcSearchFile+".cdx")
>>   ENDIF
>>   IF FILE(m.lcSearchFile+".fpt")
>>      DELETE FILE(m.lcSearchFile+".fpt")
>>   ENDIF
>>ELSE
>>   MESSAGEBOX("Not Found")
>>ENDIF
>>
>>
>>or you could drop them all in one statement
>>
>>m.PathToFile = "c:\yourdir\"
>>lcSearchFile = m.PathToFile+"aa" &&& example lcSearchFile = c:\yourdir\aa.dbf
>>IF FILE(m.lcSearchFile+".dbf")
>>   DELETE FILE(m.lcSearchFile+".*")
>>ELSE
>>   MESSAGEBOX("Not Found")
>>ENDIF
>>
>>
>>but be careful because you would delete any programs, screens, reports, etc. with the same name from that directory
>
>
>Rich,
>Short is without verification for .cdx and .fpt
>
>m.PathToFile = "c:\yourdir\"
>lcSearchFile = m.PathToFile+"aa" &&& example lcSearchFile = c:\yourdir\aa.dbf
>IF FILE(m.lcSearchFile+".dbf")
>   DELETE FILE(m.lcSearchFile+".dbf")
>   DELETE FILE(m.lcSearchFile+".cdx")
>   DELETE FILE(m.lcSearchFile+".fpt")
>ELSE
>   MESSAGEBOX("Not Found")
>ENDIF
>
Shortest is:
m.PathToFile = "c:\yourdir\"
lcSearchFile = m.PathToFile+"aa" &&& example lcSearchFile = c:\yourdir\aa.dbf
IF NOT EMPTY(SYS(2000,m.lcSearchFile+".dbf"))
   ERASE (m.lcSearchFile+".*")
ELSE
   MESSAGEBOX("Not Found")
ENDIF
:o)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform