I am writing a Windows Forms application and am testing the values of two different columns of two different records, to see if they are equal or not. If they are equal, then it is supposed to assign the value of true to a bool variable. Here is the relevant code snippet:
bTmp = false;
foreach (DataRow rInner in dtEEICD9.Rows)
if (rInner["ICD9Seq"] == r["ICD9Seq"])
bTmp = true;
I know for a fact that there is a record, in each of the two recordsets, that has the same value for the ICD9Seq column. I KNOW for a fact that the expression:
rInner["ICD9Seq"] == r["ICD9Seq"]
does evaluate to true, when the relevant record in rInner has the same value in the ICD9Seq column that r["ICD9Seq"] has. I have verified this fact by stepping through the code in the debugger and evaluating the expression
rInner["ICD9Seq"] == r["ICD9Seq"]
to see what it says for each of the records. It is only true once, but it IS true once. So, please, would someone tell me why it never assigns the value of true to the variable bTmp?
bTmp = false;
foreach (DataRow rInner in dtEEICD9.Rows)
if (rInner["ICD9Seq"] == r["ICD9Seq"])
bTmp = true;
I know for a fact that there is a record, in each of the two recordsets, that has the same value for the ICD9Seq column. I KNOW for a fact that the expression:
rInner["ICD9Seq"] == r["ICD9Seq"]
does evaluate to true, when the relevant record in rInner has the same value in the ICD9Seq column that r["ICD9Seq"] has. I have verified this fact by stepping through the code in the debugger and evaluating the expression
rInner["ICD9Seq"] == r["ICD9Seq"]
to see what it says for each of the records. It is only true once, but it IS true once. So, please, would someone tell me why it never assigns the value of true to the variable bTmp?