N
nick
I always get "Operation must use an updateable query" when I try to insert a
new record in a dbf file. My connection string is:
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\dbfs;Extended
Properties=dBase IV;User ID=Admin;Password="
And Code is
Dim dbfConnectionString as String = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\dbfs;Extended Properties=dBase IV;User ID=Admin;Password="
Dim InsertCmdStr As String = "Insert Into wolog (WOTYPE, REF_NO, PRIORITY,
Unit, DEPT, DEPT_ID, PAC2, RQNAME, RQPHONE, SHOP, ASTO, WODATE, OPTR,
LOCATION, COMM1, ESTHR, STATUS, UP, ROOM, FLR) values
('D','D700804','5','90','740','1','2BUS','a','a','SEC','','11/10/2004
2:02:27 PM','login','2 BUS ST a ','a ',0,'N','N','a','')"
Dim cmd As New OleDbCommand(InsertCmdStr, New
OleDbConnection(dbfConnectionString))
cmd.Connection.Open()
Try
REF_NO = cmd.ExecuteScalar()
Catch err As Exception
Throw err
Finally
If Not cmd.Connection Is Nothing Then
cmd.Connection.Close()
End If
End Try
The dbf file has a few indics and one of them are unique index (5 columns)
However, I can successfully run the SQL statement in MS Access to append a
record in the linked dbf table.
Any clue?
new record in a dbf file. My connection string is:
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\dbfs;Extended
Properties=dBase IV;User ID=Admin;Password="
And Code is
Dim dbfConnectionString as String = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\dbfs;Extended Properties=dBase IV;User ID=Admin;Password="
Dim InsertCmdStr As String = "Insert Into wolog (WOTYPE, REF_NO, PRIORITY,
Unit, DEPT, DEPT_ID, PAC2, RQNAME, RQPHONE, SHOP, ASTO, WODATE, OPTR,
LOCATION, COMM1, ESTHR, STATUS, UP, ROOM, FLR) values
('D','D700804','5','90','740','1','2BUS','a','a','SEC','','11/10/2004
2:02:27 PM','login','2 BUS ST a ','a ',0,'N','N','a','')"
Dim cmd As New OleDbCommand(InsertCmdStr, New
OleDbConnection(dbfConnectionString))
cmd.Connection.Open()
Try
REF_NO = cmd.ExecuteScalar()
Catch err As Exception
Throw err
Finally
If Not cmd.Connection Is Nothing Then
cmd.Connection.Close()
End If
End Try
The dbf file has a few indics and one of them are unique index (5 columns)
However, I can successfully run the SQL statement in MS Access to append a
record in the linked dbf table.
Any clue?