save row's information after dataset clear

  • Thread starter Thread starter touf
  • Start date Start date
T

touf

Hi,
I have a dataset that contain one row, I like to replace this unique row by
another one that contain the same information (with a new version number),
this is my code

Dim myRow As DataRow

Dim newVersion As String = getNewVersionNumber() ' a function that return
a new version nymber

myRow = dsfrm.Tables("cotation").Rows(0)

myRow.Item("version") = newVersion

MsgBox(myRow.Item("codeAgent")) 'display the correct code

dsfrm.Tables("cotation").Clear()

MsgBox(myRow.Item("codeAgent")) ' gives an error

dsfrm.Tables("cotation").AcceptChanges()

dsfrm.Tables("cotation").Rows.Add(myRow)



The problem is that the datarow is cleared when I clear the dataset, so the
second msgbox return me an error.

Any help please?
 
Back
Top