borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Next Topic (Help with Image links in Db, please) New Topic New Poll Post Reply
AndreaVB Forum : Database : I could not delete the file
Poster Message
wen_dell
Level: Scholar

Registered: 17-01-2005
Posts: 44

icon I could not delete the file

i could not figure out why the DBF that i trying to delete raised an error of "Permission denied" even though i closed the recordset and connection for that DBF file and set their variables to nothing. Can anybody help me with this problem


Dim CnFox As New ADODB.Connection
Dim RsCur As New ADODB.Recordset
Dim iFile As New FileSystemObject

CnFox.Open "Provider=MSDASQL.1; Driver={Microsoft Visual Foxpro Driver}; SourceType=DBF; SourceDB=" & App.Path & "; Exclusive=No;"
RsCur.Open "SELECT * FROM CurrentItemMast ORDER BY StockNo", CnFox, adOpenForwardOnly, adLockReadOnly

'my codes
'
'
'


RsCur.Close
CnFox.Close
Set RsCur = Nothing
Set CnFox = Nothing

iFile.DeleteFile App.Path & "\CurrentItemmast.dbf", True
'or
'Kill App.Path & "\CurrentItemmast.dbf"
Set iFile = Nothing


[Edited by wen_dell on 25-07-2007 at 05:46 PM GMT]

____________________________
GOD IS MY SHEPERD

25-07-2007 at 09:31 AM
View Profile Send Email to User Show All Posts | Quote Reply
GeoffS
Level: VB Lord


Registered: 29-09-2004
Posts: 536
icon Re: I could not delete the file

Hi wen_dell,
This is due to Connection Pooling, even though you have disposed of your connection variable the program is still holding a connection in the connection "Pool". This will not be disposed until you close your app completly.
You can try adding "OLE DB Services=-4;" to your connection string to mark it as a connection that is not to be pooled, but I do not use FoxPro so I'm not sure if it will work - but hey! whats to lose?


____________________________
multi-tasking - the ability to hang more than one app. at the same time.

10-10-2007 at 04:33 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : I could not delete the file
Next Topic (Help with Image links in Db, please) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder