Servlet Recordset not allowing String Comparision

Howdy,

I'm stumped. It should work, but it doesn't. After getting a record set back from a database, I do a comparision of its value with a coparable string, in this case "0". It always returns false, even though when I print our the values brought back from the database, 0 is a valid returned value. Here is the code

String vUser_ID = dbResultSet.getString("User_ID");

boolean hey=vUser_ID.equals("0");

I got rid of any spaces and it is a string... what gives? Anybody have a clue?

Thanks

[536 byte] By [croyus] at [2007-9-26 1:20:35]
# 1
check the length of v_User_ID? the zero is a really a zero? dunno...just guessing...
esmo at 2007-6-29 0:54:56 > top of Java-index,Archived Forums,Java Programming...
# 2

Well....It looks good to me and it's probably something silly like untrimmed spaces or that or o (letter 'o') for a 0 (zero)...

Try this just to make sure that you are trimming the spaces

String vUser_ID = dbResultSet.getString("User_ID");

System.out.println(vUser_ID);

boolean hey=vUser_ID.trim().equals("0");

Also make sure that the database is returning a 0(zero) and it's not an o (letter o)...and the string in equals() method is 0(zero) and not the o (letter o)

prowzen at 2007-6-29 0:54:56 > top of Java-index,Archived Forums,Java Programming...