How to update or delete a row in CSV file
I am trying to delete or update a CSV file using a ADODB recoredset in VB6.0. Its giving a error multiple data can't be updated.
Actually, i am having some (around 50) records in my CSV file. I am able to add new records in the same file but not able to update nor delete the record from the CSV files. When i run this code it gives error message
objconnection active connection
strPathtoTextFile = App.Path & "\Data\"
If objconnection.State <> 0 Then Set objconnection = Nothing
objconnection.ConnectionString = _
"Driver={Microsoft Text Driver (*.txt; *.csv)};" & _
"DefaultDir=" & strPathtoTextFile
objconnection.Open
Private Function deleteob()
Dim showrs As New ADODB.Recordset
Dim sqlstr As String
sqlstr = "delete from Observation.csv where ob_code=" & txtOb_code
If showrs.State <> 0 Then Set showrs = Nothing
showrs.Open sqlstr, objconnection, adOpenDynamic, adLockOptimistic
End Function
It gives error message "Delete Data in a linked table is not supported by this ISAM".
|