aspose file tools*
The moose likes JDBC and the fly likes problem with rs.getString Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "problem with rs.getString" Watch "problem with rs.getString" New topic
Author

problem with rs.getString

mike sutton
Greenhorn

Joined: Dec 07, 2000
Posts: 14
I want to do different things based on the results of a field in my table. I can do a

out.println(rs.getString("admin_type"))
and it will show me the correct information. But when I try this line
if (rs.getString("admin_type").equals("ORGIN")) {...
I get an sql exception.
could someone please tell me what is wrong with this line, or if I am totally off base how I can implement an if statement based on the result of a field in a dbase.

thanks in advance
Mike
never mind I figured it out. I added a vector like this

Vector type = new Vector();
added a string
String[] admintype = null;
and then added this code
type.addElement(rs.getString(3));...
admintype = new String[type.size()];
type.copyInto(admintype);
now this line works
if (admintype.equals("ORGIN")) {...
(thought I would add this in case any other newbie had a similar problem.)

[This message has been edited by mike sutton (edited December 14, 2000).]
[This message has been edited by mike sutton (edited December 14, 2000).]
 
Don't get me started about those stupid light bulbs.
 
subject: problem with rs.getString