If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Can't rename directory after accessing recordset

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-07-03, 06:24
xnl28@hotmail.co xnl28@hotmail.co is offline
Registered User
 
Join Date: Aug 2002
Posts: 1
Can't rename directory after accessing recordset

Hello all,

I wonder if any of you know how to get around this problem. I create a
Connection String to a certain directory, then execute a query to extract
some data from a DBF. After doing that, I can no longer rename that
directory; it appears to be locked.

The code is below.

Set oConnDBF = New ADODB.Connection
oConnDBF.Open "Driver={Microsoft dBASE Driver (
*.dbf)};DriverID=277;Exclusive=No;Dbq=C:\RM;"
Set rs = oConnDBF.Execute("select COL3 from table")
sys$ = rs.Fields(0)
rs.Close
Set rs = Nothing
oConnDBF.Close
Set oConnDBF = Nothing

To test where the problem is, I single-step each line in VB, then try to
rename the C:\RM dir in a DOS window. I can rename C:\RM until I execute the "Set rs = oConnDBF.Execute" line. After executing that, DOS tells me "The process cannot access the file because it is being used by another process." Which is what I expect.

But after executing the next 4 lines (closing and setting the objects to
nothing), I still get the same DOS error. I would have thought that
closing and setting to nothing would have released any handles open to the C:\RM directory. What have I overlooked?

And even stopping the VB program doesn't allow the C:\RM dir to be
renamed. It is only after I exit VB that I can rename the directory.

Any ideas would be welcome.

-Steve
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On