How to distinguish between DataRow state and DataRow version in ADO.NET? RRS feed

  • Question

  • User236664382 posted

    What is the difference between DataRow state and DataRow version in ADO.NET?

    Friday, July 5, 2019 7:52 AM


  • User288213138 posted

    Hi gogoalshop,

    1.Row state indicates the status of a row, it has 5 kinds, respectively is UnChanged, Added, Modified, does, Detached. The newly created row (DataRow object) is in the Detached state. After it is added to the DataTable object, the state of the DataRow object becomes the Added state. If the DataRow has been Modified, the line is in the Modified state. If the DataRow object is removed from the table using the Remove method, or if the row is removed using the Delete method and the AcceptChanged method, the row is in the Detached state.

    2.Row versions maintain the values stored in a row as it is modified, including current, original, and default values. There are four different versions of DataRow version, namely Current, Original, proposed and default. You can pass the DataRowVersion parameter through a column reference to see different DataRow versions.the AcceptChanged method is called, all rows in the deleted state will be in the Detached state, ie removed. The rest of the rows will change to the Unchanged state, and the value in the Original version will be rewritten to the value of the current row version.

    More information you can refer to this link:Row States and Row Versions

    Best regards,


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 5, 2019 9:50 AM