save row's information after dataset clear

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top