none
Row 0 not updating. RRS feed

  • Question

  • Hello all,

     

    I am trying to update a database table with data from a bound datagridview. Currently when I fire the update command all rows except for row 0 update. What am I doing wrong?

     

    Code Snippet

    Dim x As Integer

    Dim strForwardDate As String = Now

    For x = 0 To fds.Tables(0).Rows.Count

    Me.DataGridView1.Rows(x).Cells("currentuser").Value = Me.cboForwardTo.Text.Trim '<< CurrentUser >>

    Me.DataGridView1.Rows(x).Cells("forwarddate").Value = strForwardDate '<< ForwardDate >>

    Me.DataGridView1.Rows(x).Cells("user4").Value = Me.DataGridView1.Rows(x).Cells("user3").Value '<< User4 >>

    Me.DataGridView1.Rows(x).Cells("user3").Value = Me.DataGridView1.Rows(x).Cells("user2").Value '<< User3 >>

    Me.DataGridView1.Rows(x).Cells("user2").Value = Me.DataGridView1.Rows(x).Cells("user1").Value '<< User2 >>

    Me.DataGridView1.Rows(x).Cells("user1").Value = Me.cboForwardTo.Text.Trim '<< User1 >>

    Me.DataGridView1.Rows(x).Cells("status").Value = "1" '<< Set Status to 1 (FWD) >>

    Next

    Me.DataGridView1.EndEdit()

    Dim updatecmd As New OleDb.OleDbCommand

    fdt = fds.Tables(0)

    fcb = New OleDb.OleDbCommandBuilder(fda)

    If fds.HasChanges Then

    fda.Update(fds, fdt.TableName)

    Else

     

    End If

     

     

     

    Thanks,

    Tom

     

     

    Monday, May 12, 2008 5:16 PM