Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete from dbf problem

Status
Not open for further replies.

mariuslaurentiu

Programmer
May 31, 2005
10
0
0
RO
Hi,
I use dbf table to store data.When i try to delete some records i received one error:
"File must be opened exclusively"
This table isn't in database.
Please help
Thank you
 
IF you go after the DBF file as a regular file instead of using the database driver then you'll probably want to also update the header information to reflect the changes you've made.
 
I use this function for connection with the table


Public Function InitFoxConnection(ByVal lPath As String, ByRef lCon As ADODB.Connection, Optional lExclusive As Boolean = True, _
Optional lUser As String = "", Optional lPassword As String = "", _
Optional lSourceType As String = "DBF") As Boolean
Dim mCon As ADODB.Connection
Set mCon = New ADODB.Connection
Set lCon = Nothing
InitFoxConnection = True
On Error GoTo ErrorHandler


With mCon
If .State = adStateOpen Then
.Close
End If
.CursorLocation = adUseClient
.Mode = adModeShareExclusive
'adModeReadWrite
.ConnectionString = _
"Driver={Microsoft Visual FoxPro Driver};" & _
"Uid=" & Trim(lUser) & ";pwd=;" & Trim(lPassword) & _
"SourceDB=" & lPath & ";" & _
"SourceType=" & Trim(lSourceType) & ";" & _
"Exclusive=Yes" & ";"
.Open
End With

Set lCon = mCon
Exit Function
ErrorHandler:
MsgBox "Conexiunea la baza de date a esuat ..." & vbCrLf & _
Err.Description, vbCritical, gAppName
InitFoxConnection = False
End Function



when i try to execute the "pack" command i receive the error
Please excuse my English.
Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top