Why are these NOT equal?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Bartel

    Why are these NOT equal?

    I have a routine to compare the current value with the original value of
    fields in a Datatable. The code loops through each column to compare the
    values and builds an update statement for those columns that have changed.

    But for some reason, the Datetime fields are evaluating as not equal when
    they are! (I just retreived the row and did nothing with the Datetime
    columns, and in the debugger "a" and "b" look the same).

    Here is the code:

    DataRow Row = MyTable.Rows[0];

    foreach (DataColumn column in Columns)
    {
    a = Row[column.ColumnNa me, DataRowVersion. Current];
    b = Row[column.ColumnNa me, DataRowVersion. Original];

    if (b != a)
    {
    //Build Update Statement
    }
    }

    Any thoughts anyone?

    Thanks in advance.

    Bob Bartel

Working...