Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to free up a busy file
Message
 
 
To
24/07/2003 09:47:53
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00813076
Message ID:
00813099
Views:
8
This message has been marked as the solution to the initial question of the thread.
Steve,

The table name you're creating is illigal for the table alias because it includes '-' (dash). Either change it to "_" (underrscore) or open the table explicitly and asign an alias to it. After you done, close the table with USE IN command
Copy To (lcTable)
ALTER ...
...
USE (lcTable) IN 0 ALIAS SetTempTable
...
		Select * From (lcTable) Into Cursor cExport Readwrite
		Select cExport
                USE IN SetTempTable
		Delete File (lcTable+'.*')
>I have a cursor that I am writing out to a table using "COPY TO". Then I alter that table, dropping fields. A user has selected from an optiongroup what type of output they want. If it is excel or lotus I select the newly created table, export to the appropriate format then delete the .dbf table.
>Well, foxpro can't delete the DBF file. It returns an error "the file '' was busy, try again later" Through trial and error I have found that it is the line of code
Delete File (lcTable+'.*')
>
inside the case statement below. I have tried
use in (lcSetName)
but that alis doesnt exist. I need to free up that table so I can delete it
>
>
Select cExport
>**alter table doesn't work at this point,
>**performed after writing cursor out below
>*!*	ALTER TABLE cExport drop COLUMN fkey
>*bROWSE last
>
>Local lcTable, lcSetName, lcDir
>lcSetName='Set-'+Alltrim(Thisform.ztoolset)
>lcDir=Thisform.cntgetfilemy1.cvalue+lcSetName+'\'
>If Directory(lcDir)
>	Set Safety Off
>	Delete File (lcDir+'*.*') recycle
>	Set Safety On
>Else
>	Mkdir(lcDir)
>Endif
>lcTable=Alltrim(lcDir+lcSetName)
>
>Copy To (lcTable)
>**remove key fields
>Alter Table (lcTable) Drop Column fkey
>Alter Table (lcTable) Drop Column ftoolset_b
>Alter Table (lcTable) Drop Column ftoolset_a
>Alter Table (lcTable) Drop Column fisnum
>Alter Table (lcTable) Drop Column ftnum
>Alter Table (lcTable) Drop Column fbinnum
>Alter Table (lcTable) Drop Column flocnum
>Alter Table (lcTable) Drop Column fpnum
>Alter Table (lcTable) Drop Column fvnum
>Alter Table (lcTable) Drop Column fponum
>Alter Table (lcTable) Drop Column fvdwgnum
>Alter Table (lcTable) Drop Column fhdwgnum
>Alter Table (lcTable) Drop Column fpressnum
>
>Do Case
>	Case Thisform.ogmy1.Value=2
>		Select * From (lcTable) Into Cursor cExport Readwrite
>		Select cExport
>		Delete File (lcTable+'.*')
>		Export To (lcTable) Type Xls
>	Case Thisform.ogmy1.Value=3
>		Select * From (lcTable) Into Cursor cExport Readwrite
>		Select cExport
>		Delete File (lcTable+'.*')
>		Export To (lcTable) Type Wks
>Endcase
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform