I’m currently trying to compare in C#
a value I get from my database
, and i use “IsNullOrEmpty” to check if the value is, well, null or empty.
When the value in the database
is “null”, no problem.
However, when the value is “empty”, I still enter the loop;
I add an empty value:
update Planning set Repas2 ='' where jour = '01/11/19' and Matricule='601'
And now the debug :
as you can see, “Repas2” is empty but I still go in the loop.
Anyone know why I’m doing this?
Advertisement
Answer
Use string.IsNullOrWhiteSpace(...)
instead