String comparison
i have writen an SQL statement which returns a fields value within a table as a String.
for most of the instances in the table there is a value which returns a non empty String and the copmarison works fine, but for some instances the return is null....because it is empty
for this reason i keep getting errors
here is the code i am using to compare
connAdd = brokerQueries.queryAdd(count);
if (!connAdd.equals(""))
{
}
anyone have any clues?
Tried
!"".equals(conAdd)
?
Or at least checking for null before calling any methods?
Edit: the above statement doesn't help in this case, sorry.
You need to explicitely check for null if you want to react in the same way on null and empty strings.
Message was edited by:
CeciNEstPasUnProgrammeur
hey sorry for the late reply i have been away for a while...i managed to fix the probelm
what i done was create one loop using
if ( connAdd == null)
{
}
and instead of putting in another if statement i put an else statement and it all seemed to work...
thanks for your help though