I am trying to compare two DataRowin a loop. However, the following statement ifdoes not return true:
if (dt1.Rows[0]["Name"] == dt2.Rows[b]["Name"]) {
// This never executes
}
However, if I add .ToString()at the end of each DataRow, the operator ifwill return true:
if (dt1.Rows[0]["Name"].ToString() == dt2.Rows[b]["Name"].ToString()) {
// This now executes
}
The "Name" column refers to the same table / column. So the question is pretty simple ... What am I doing wrong?
Thanks
Steven
source
share