Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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



 
Marshal
Posts: 25835
69
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic