• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Select statement only returns one value

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am implementing a filter to my search interface that allows a user to display results that have been added within the past 10 days. My program brings back an output, but it's only one when there are at least 3 values in my database that would fit the filter. Is there something I need to change in my code in order to get it to output ALL values that the select statement applies to?

 
Bartender
Posts: 1205
38
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Little hint :you need to iterate over your cursor...
 
Rancher
Posts: 3404
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ResultSet is capable of containing more than one row... but you have to call next() more than once to access the other rows.  Usually this is done with a while statement.  Simply change your code here:

to this:
 
Taylor Manley
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!

worked really well
 
This will take every ounce of my mental strength! All for a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!