• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 566
  • Last Modified:

can't use getString to get char value

if (rst.getString("Inv_ItemModelNo").equals(""))  -----> if Inv_Type data type varchar den this statement is working

if (rst.getString("Inv_Type").equals(""))  -----> if Inv_Type data type char den this statement is nt working (how to make this work?)

thks


            
0
mayachoy
Asked:
mayachoy
  • 3
  • 2
  • 2
  • +2
2 Solutions
 
basicinstinctCommented:
Would this work?

if (Character.toString(rst.getString("Inv_Type")).equals(""))
0
 
jpolin1Commented:
How about:

if (rst.getString("Inv_Type") == '')

That is 2 single quotes at the end.

If rs.getString is returning type char (java primitive) then you cannot perform a .equals operation on it, its not an object.
0
 
mayachoyAuthor Commented:
both way are nt working

on my jsp is still not working
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
jpolin1Commented:
What exception are you getting when the data type is char ?
0
 
KruleCommented:
if (String.valueOf(rst.getString("Inv_Type")).equals("") )
0
 
mayachoyAuthor Commented:
i had tried all the solution above still not working.
0
 
mayachoyAuthor Commented:
if (!rst.getString("Inv_Type").equals("OH"))

if (!rst.getString("Inv_ISOCountryCode").equals("ID"))

both inv_type and Inv_ISOCountryCode are char type

but inv_type is working on the if statement but Inv_ISOCountryCode  is nt working in the if statemenet

is it because the field name too long? is it jsp got such limits? if yes how should i solve it?

thanks
0
 
KruleCommented:
I suggest some debugging techniques.

Print out (display) what is in the field, so you can see. Perhaps the data you are getting back is not what you are expecting?
0
 
Mujtaba_Alam_KhanCommented:
have you tried:

if (rst.getString("Inv_Type").equals(null))

-Muj ;-)

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now