View Single Post
  #2 (permalink)  
Old August 14th, 2003, 07:30 AM
jwenting jwenting is offline
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jwenting Send a message via MSN to jwenting
Default

Quite simple. You are returning a fixed string with the value "title" for each row in the database where your call number is the one you entered.

You should do something like:
    PreparedStatement selectCurrentValue = databaseConnection.prepareStatement("SELECT * FROM cardCatalog WHERE callNumber = ?");
    selectCurrentValue.setString(1, callNumber.getText());
    ResultSet rs = selectCurrentValue.executeQuery();
     String title = null;
     if(rs.next())
     {
        title = rs.getString(title);
     }
     else title = "";
     String currentValue = title;
    
no need for Vectors here, your code is overly complicated as you'll only ever want a single result (and expect no more than 1).