This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

counting a subset of records  RSS feed

 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a table with a particular column named ID

The records in the table have an integer in the field and there may be several records with the same integer value

I am using the following code where Search_ID has just been calculated...........

The program falters on this line and I am unclear why ?

Bob M
 
Bob Matthews
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry..........missed  quote marks
 
Sheriff
Posts: 24085
54
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to guess that Search_ID is not a column in that database table, and "faltering" means the program crashes because of that error. More information on your problem would be extremely useful.

I see that you are using a PreparedStatement, which is a good first step. But guessing (again) that Search_ID is a variable in your code, or something like that, then the PreparedStatement would look something like this:



Then you would use ps.setInt() to fill in the question mark before executing the SQL.

Hope that helps -- if I'm on the wrong track then by all means help us by providing a full description of the problem.
 
Bob Matthews
Ranch Hand
Posts: 190
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul..that did it

Bob M
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!