Dan Zruna
12/9/2002 4:23:00 AM
I'm getting the following error, ERROR [22018] [Microsoft]
[ODBC Visual FoxPro Driver]Data type mismatch, when trying
to update a FoxPro database using the ODBC provider. Has
anyone gotten this to work??? Any suggestions would be
greatly appreciated.
Here is my code:
Dim da As New OdbcDataAdapter()
Dim ds As New DataSet()
Dim cn As New OdbcConnection()
Dim cb As New OdbcCommandBuilder()
cb.QuotePrefix = "["
cb.QuoteSuffix = "]"
cn.ConnectionString = _abra
cn.Open()
da = New OdbcDataAdapter("select * from hrpersnl",
cn)
cb = New OdbcCommandBuilder(da)
da.Fill(ds, "Employee")
'Add a record to the table.
Dim tbl As DataTable
tbl = ds.Tables("Employee")
Dim test As String =
cb.GetInsertCommand.CommandText
Dim dr As DataRow
dr = tbl.NewRow()
dr("p_aborig") = "N"
dr("p_abotype") = ""
dr("p_accumcur") = 0
dr("p_active") = ""
dr("p_allocby") = ""
dr("p_annual") = 0
dr("p_anychang") = CType(Now(), Date)
tbl.Rows.Add(dr)
da.Update(ds, "Employee")
cn.Close()