none
c# how do I get a DataRow's Original value to be the DataRow Current value?

    Question

  • After posting data to a table and calling AcceptChanges the value of the datarow[datacolumn,DataRowVersion.Original] is still the original value from the table rather than being updated to the DataRowVersion.Current value.

    How can I get the data row original values to sync with the data just posted to the table without re-reading the data from the table?

    I am using VS 2008, ,NET Framework 3.5

    Regards,

    PDC


    Paul D Campion

    Wednesday, December 12, 2012 9:47 PM

Answers

  • The issue is when I know for a fact the value has changed.

    QTY = 0 when the row is read from the table.

    QTY = 1 when the user edits the data

    adapter.Update(dataSet) is called and data is posted to the table

    value in table is now QTY = 1.

    dataSet.AcceptChanges() is called.

    row["QTY",DataRowVersion.Current] = 1

    row["QTY",DataRowVersion.Original] = 0

    This row is retained because this was an intermittent save, allowing the user to re-edit the row after posting to the database.


    Paul D Campion

    Thursday, December 13, 2012 12:33 PM

All replies

  • One possibility is that you may not have actually made any changes to the datarow before calling AcceptChanges(), in this case both Original and Current will have the same value.


    Thanks, Murugesan M - Please Mark as the Answer, if this answers your question. Please vote as helpful, if this post is helpful.

    Wednesday, December 12, 2012 11:11 PM
  • The issue is when I know for a fact the value has changed.

    QTY = 0 when the row is read from the table.

    QTY = 1 when the user edits the data

    adapter.Update(dataSet) is called and data is posted to the table

    value in table is now QTY = 1.

    dataSet.AcceptChanges() is called.

    row["QTY",DataRowVersion.Current] = 1

    row["QTY",DataRowVersion.Original] = 0

    This row is retained because this was an intermittent save, allowing the user to re-edit the row after posting to the database.


    Paul D Campion

    Thursday, December 13, 2012 12:33 PM