I am totally new to Java. I am trying to get a query to execute which will return to a combo box in another class. I am confused about the Vector functions and how to make them work. The book that I am working from is not clear to me.
Again, all I want to do is to have the DB look up all facilities. Then I want to create the object that does that (FacilityList) and display the values in a combo box in the class where it needs to be displayed (not included in the code below). I am sure that something is way off. I don't get this to compile yet because of the "DownRow" method. But, I am not sure that any of it is right anyway. Thanks for the help.
First thing I would say is try to use the normal naming conventions for variables. i.e. start with lower case.
The second main problem I see is with your DownRow method. You try currentRow.addElement(DisplayResults). DisplayResults is a ResultSet. I'm pretty sure you don't want to add the ResultSet to the vector, rather you want to add some information from the database rows in the result set. The result set will contain entries for each row returned by your query. You have to access this information using methods like getInt("columnName") to retrieve data for a column, and next() to advance to the next row returned by the database.
Rather than re-write your problem. I've written a simple example, which hopefully you can work from:
Joined: Apr 18, 2005
Thank you Horatio.
That solved a whole bunch of problems and helped me see the light all at the same time. Thanks so much.