| Author |
compare resultset values with string value
|
tushar panda
Ranch Hand
Joined: Feb 16, 2009
Posts: 133
|
|
the code is wriiten so that it will chec whether the username value is present in result set or not .
rs1 is result set .
username value is given "SMITH" & the result set is the set of "ename" from emp table in oracle db.
in line 4 i have checked the value of username is "SMITH" which i have passed before .
my problem is the condition always evaluates to false , but it should be true , maybe the comparision in line 5 is not right, is it required to convert the "rs1.getString(i)" to string . i am a bit confused how can i search for username in resultset
|
Do Right , Fear No Man
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
|
Probably because you are using == for comparing two reference types.
|
 |
tushar panda
Ranch Hand
Joined: Feb 16, 2009
Posts: 133
|
|
Campbell Ritchie wrote:Probably because you are using == for comparing two reference types.
thanks for the answer ,
but still i cannot understand how to compare , it would be great if you can show me some code.
one more thing , result set is in string format but what happens when i am comparing it.
Regards
TUSHAR
|
 |
 |
|
|
subject: compare resultset values with string value
|
|
|