What is wrong with this code?
I am trying to do a simple update to a dataset, and I get an error on da.update.
Public Sub UpdateCLastTestDate(ByVal strConnect As String)
Dim da As New OleDbDataAdapter()
Dim cn As New OleDbConnection(strConnect)
Dim cmd As New OleDbCommand("SELECT * FROM mcTestingReport", cn)
Dim ds As New DataSet()
Dim cb As OleDbCommandBuilder = New OleDbCommandBuilder(da)
da.SelectCommand = cmd
da.Fill(ds, "mcTestingReport")
Dim i As Integer
For i = 0 To ds.Tables("mcTestingReport").Rows.Count - 1
If Not IsDBNull(ds.Tables("mcTestingReport").Rows(i).Item("cLastTestDate")) Then
If ds.Tables("mcTestingReport").Rows(i).Item("cLastTestDate") > ds.Tables("mcTestingReport").Rows(i).Item("NextTestDate") Then
ds.Tables("mcTestingReport").Rows(i).Item("NextTestDate") = #1/1/1900#
End If
End If
Next i
da.Update(ds, "mcTestingReport")
cn.Close()
End Sub
Could you be more specifc?
Could you be a little more specifc? Are you talking about running my own SQL update? What is the code going to look like?