Well, this is probably very simple, but I have the following “checks” (not at the same time) , and the first ALWAYS evaluates to TRUE, and the second SEEMS - to work. It actually happens in every place that the string value is a number or bool (Date seems fine...) .
If I go through the code in Debug, it shows the value of row["PersonID"] as 162434 , the same as tbxPersonID.EditValue . Is this just the basic and novelty of the programming truth I missed in my hodge-podge-self-education ?
It seems that if I included everything in question in a string , at first I will be fine, I just wanted to know if I am correct and if there is a general rule regarding what Types I will need to do this for?
Does not work
if (row["PersonID"] != tbxPersonID.EditValue) { row["PersonID"] = tbxPersonID.EditValue; } if (row["CitizenFlag"] != chkCitizen.EditValue) { row["CitizenFlag"] = chkCitizen.EditValue; _whatChanged.Add("CitizenFlag"); }
Work
if (row["PersonID"].ToString() != tbxPersonID.EditValue.ToString()) { row["PersonID"] = tbxPersonID.EditValue; } if (row["CitizenFlag"].ToString() != chkCitizen.EditValue.ToString()) { row["CitizenFlag"] = chkCitizen.EditValue; _whatChanged.Add("CitizenFlag"); }
Refracted paladin
source share