File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes problem with rs.getString Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "problem with rs.getString" Watch "problem with rs.getString" New topic

problem with rs.getString

mike sutton

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

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
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
admintype = new String[type.size()];
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).]
I agree. Here's the link:
subject: problem with rs.getString
It's not a secret anymore!