Ok true believers, kudos for anyone that can solve this riddle.
Background:
Using the adodb ver 7.0.3300.0 .NET object ref.
Using foxpro database tables in a local directory.
Using this code:
Private Sub adoTest()
'create CNN and RecSet
Dim cnn As New ADODB.Connection()
Dim Rec As New ADODB.Recordset()
'set path, and table name
Dim sTableName As String = "RNM.DBF"
Dim sFoxProPath As String = "c:\dbf\"
cnn.ConnectionString = "Provider=MSDASQL;dsn=update2;datasource= " & sFoxProPath & sTableName
cnn.Open()
Rec.CursorLocation = ADODB.CursorLocationEnum.adUseClient
Rec.CursorType = ADODB.CursorTypeEnum.adOpenKeyset
Rec.LockType = ADODB.LockTypeEnum.adLockReadOnly
Dim sql As String = "select * from " & sTableName
Rec = cnn.Execute(sql)
' Record found
Dim iNoDocuments As Integer = Val(Rec.Fields("Order".Value & ""
Dim sdocname As String = Trim(Rec.Fields("docname".Value & ""
MsgBox(iNoDocuments & " " & sdocname)
Rec.Close()
cnn.Close()
System.Diagnostics.Debug.WriteLine(" After closing: " & cnn.State)
cnn = Nothing
Rec = Nothing
‘forcing GC to occure.. out of ideas for freeing up dbf file
‘still not working though L
System.GC.Collect(2)
end sub
OK now after that completes if i try to copy the dbf file, kill it or do anything to it.. it says that it's being used by another process.. when this is not the case.
Now the only way that i have been able to get this to work is by opening up a new dbf file, then it seems to free up the old one. but this means that i would have to put in a temp dbf file on the target system..
Suggestions?
--------------
Background:
Using the adodb ver 7.0.3300.0 .NET object ref.
Using foxpro database tables in a local directory.
Using this code:
Private Sub adoTest()
'create CNN and RecSet
Dim cnn As New ADODB.Connection()
Dim Rec As New ADODB.Recordset()
'set path, and table name
Dim sTableName As String = "RNM.DBF"
Dim sFoxProPath As String = "c:\dbf\"
cnn.ConnectionString = "Provider=MSDASQL;dsn=update2;datasource= " & sFoxProPath & sTableName
cnn.Open()
Rec.CursorLocation = ADODB.CursorLocationEnum.adUseClient
Rec.CursorType = ADODB.CursorTypeEnum.adOpenKeyset
Rec.LockType = ADODB.LockTypeEnum.adLockReadOnly
Dim sql As String = "select * from " & sTableName
Rec = cnn.Execute(sql)
' Record found
Dim iNoDocuments As Integer = Val(Rec.Fields("Order".Value & ""
Dim sdocname As String = Trim(Rec.Fields("docname".Value & ""
MsgBox(iNoDocuments & " " & sdocname)
Rec.Close()
cnn.Close()
System.Diagnostics.Debug.WriteLine(" After closing: " & cnn.State)
cnn = Nothing
Rec = Nothing
‘forcing GC to occure.. out of ideas for freeing up dbf file
‘still not working though L
System.GC.Collect(2)
end sub
OK now after that completes if i try to copy the dbf file, kill it or do anything to it.. it says that it's being used by another process.. when this is not the case.
Now the only way that i have been able to get this to work is by opening up a new dbf file, then it seems to free up the old one. but this means that i would have to put in a temp dbf file on the target system..
Suggestions?
--------------