• 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
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • 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: 1249
39
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...
 
Master Rancher
Posts: 3437
35
  • 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
 
Where does a nanny get ground to air missles? Protect this tiny ad:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!