Hi All,
I am relatively new to
Java programming. I am working with servlets and cant figure out how to
convert the string data read from the database to integer type. Any help will
be highly appreciated.
Thx in advance
Yogesh Agarwal
Hi Yogesh,
Try using rset.getInteger() to get
an Integer object out of the result set
first.
If the integer you want is really a string (varchar
or some other database type) then you cannot guarantee that the string will
parse
correctly so....
try {
myint =
Integer.parseInt(stringFromDB);
catch(NumberFormatException nfe)
{
take corrective action
here
}
and
so on.