SetAdded and SetModified can only be called on DataRows with Unchanged DataRowState.
  • hi all i am facing this error SetAdded and SetModified can only be called on DataRows with Unchanged DataRowState. in vb.net on this below code on bold line

    For Each dr As DataRow In dtBankStatement.Rows
                If dr("Selected") = True Then
                   dr.SetAdded()
                   dtSave.ImportRow(dr)
                End If
            Next

  • 1 Comment sorted by
  • Vote Up0Vote Down WaqasWaqas
    172.00 Karma Accepted Answer
    use dtBankStatement.AcceptChages() before your code like

    dtBankStatement.AcceptChanges()
    For Each dr As DataRow In dtBankStatement.Rows
                If dr("Selected") = True Then
                   dr.SetAdded()
                   dtSave.ImportRow(dr)
                End If
            Next

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Tagged

Popular Posts of the Week

Top Posters Weekly

Optimum Creative