tags:

views:

30

answers:

0

How can i add and update new row into sql server through vb.net? The foll code is generating error on update statement.

    Dim cb As New OleDb.OleDbCommandBuilder(da)
    Dim sql As String
    sql = "SELECT * from resumemaster"
    connect(sql, "resumemaster")
    Dim dsrow As DataRow
    dsrow = ds.Tables("resumemaster").NewRow
    For Each ctl2 As Control In Me.GroupBox2.Controls
        If TypeOf ctl2 Is TextBox Then
            If ctl2.Name = "txtobjective" Then
                dsrow.Item("Objective") = ctl2.Text
                ds.Tables("resumemaster").Rows.Add(dsrow)
                da.Update(ds, "resumemaster")
            End If
        End If
    Next