|
-
Mar 14th, 2002, 02:43 PM
#1
Thread Starter
Addicted Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|