• 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

Using SELECT statement with sql populated comboboxes

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a sql statement that compares the favorites list of two users. On it's own it works fine, but I am trying to connect to it two comboBox that I have created. These comboboxes' prompt the user to choose between available users to compare. How would I add the comboBoxes into my sql statement? If I should use a preparedStatement, what should I exchange in my sql statement for a ? value?

This is my code for the sql statement activated by a button click





And my two combo boxes



 
Sheriff
Posts: 24743
59
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Taylor Manley wrote:How would I add the comboBoxes into my sql statement? If I should use a preparedStatement, what should I exchange in my sql statement for a ? value?



You don't do that. You extract the data from the comboBoxes -- most likely you want to get the selected item from each of them -- and then put that data into the PreparedStatement in the usual way.
 
F is for finger. Can you stick your finger in your nose? Doesn't that feel nice? Now try this 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!