General information
Category:
Database DAO/RDO/ODBC/ADO
Title:
Resultset doesn't let go of .dbf file on .close method
When I open a VFP .dbf file with an RDOresultset, and then use the .close method on the resultset, I cannot filecopy that .dbf. VB still has the file in use.
If I destroy the object reference to the RDOconnection, I can then copy the file.
Does anyone know what method I need to use in order to get VB to let go of that dbf ... without destroying the RDOConnection?
Thx, in advance, for any assistance in this regard.
Scott Barker
'*****************************************
'** Here's my test code...
Dim cn As New rdoConnection
Dim rs As rdoResultset
Dim sqlcmd As String
cn.Connect = "SourceType=DBF;SourceDB=c:\vbvfp;Driver={Microsoft Visual Foxpro Driver}"
cn.CursorDriver = rdUseOdbc
cn.EstablishConnection "rdDriverNoPrompt"
sqlcmd = "select * from tmp_cli"
Set rs = cn.OpenResultset(sqlcmd, rdOpenKeyset, rdConcurRowVer)
' *** The file gets edited here...
rs.Close
FileCopy ..... etc...
' A file copy at this point produces a permission denied error ... the .dbf is still in use.
'*****************************************
' If I try to copy the file ... I get an error here as VB still has the file open... I confirmed that the file is in use as I cannot open the dbf in VFP if I stop the code right here.
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only