Dear All,
I have a value, strObjectAPIID, and I am comparing it to a dataset value in a loop. What i want is, if the value is equal, do not do anything, but if it is not equal, write it to the table.
However, i have to check the value with the whole dataset, for example i have the following:-
strObjectAPIID = abc123
and the values in the dataset are aaa123, aab123, abc123.
So the first value is not equal, however the third value is equal, so I am not supposed to write it in the table.
So basically, what I want to do is, if strObjectAPIID is not existing in the whole dataset, then commit to table.
At the moment my current code is like this:-
for (int j = 0; j < dsExisitingCodes.Tables[0].Rows.Count; j++)
{
rowCounter = dsExisitingCodes.Tables[0].Rows.Count;
strTableAPIID = (dsExisitingCodes.Tables[0].Rows[j][0].ToString());
if ( strObjectAPIID == strTableAPIID)
{
bFound = true;
break;
}
}
And what happens is that if the value is not equal, then I am loosing it. How can i arrange it to commit to the database?