How to get the unchanged row of a changed row - ado.net 2.0

R

Rolf Welskes

Hello,
I have the following problem:

I have a table and in this I have rows say:
Name, PreName, street. as fields.

Now a have a row for example:

Smith, John, new street 5 .

Now I make a change to this row to:
Smith, Harry, .....

Now I can get this row for example with table.Select.

But I want the unchanged row:

I have tried:

table.Select(null, null, DataViewState.ModifiedCurrent);
and I have tried
table.Select(null, null, DataViewState.ModifiedOriginal);

in both cases, yes, I get the row witch was modified, but in both cases I
get the changed row.
I want the row witch was changed, but the orignal before changing.

How to do this.

Thank you for any help.
Rolf Welskes
 
W

WenYuan Wang

Hi Rolf,

"table.Select(null, null, DataViewState.ModifiedOriginal)" and
"table.Select(null, null, DataViewState.ModifiedCurrent)" will return the
rows which has been changed.(Both Original vaule and Modify valule)

To get the original value please use the follow method.
DataRow[] drl= table.Select(null,null,DataViewRowState.OriginalRows);
Drl[index][column, DataRowVersion.Original] is the Original vaule.
Drl[index][column] is the Modify value.

Additonally, another way to approch this:
DataView dv = new DataView(table);
dv.RowStateFilter = DataViewRowState.ModifiedOriginal;
dt.Rows[index][column] is the Original value.

Hope this helps. Please feel free to let me know if you have anything
unclear.

Have a great day.
Sincerely,
Wen Yuan
 
R

Rolf Welskes

Hello,
thank you for your informations,
I have tried it out, it works.
Thank you again and best regards
Rolf Welskes
 

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