• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Retrieving records using select bean

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. I have an application where, I want the user to be able to key in a vendor number and have the record for that number displayed. I have a select bean accessing the database, but I'm a bit confused on how to retrieve certain records. I want to say, select records where vendor number is equal to, whatever the value is keyed in the JTextField. Could someone please help? (Just to let you know, I am a newbie 100%, so take it easy on me!) Thanks in advance!
 
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jennifer,
This isn't the correct forum to display this question since it's not directly related to IDE. I'm just not sure whether to move it to JFC/Swing or JDBC. I'm not even sure your question is JDBC related, so I'll move it to JFC/Swing and maybe someone can help you on the JTextField part.
-Peter
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is probably more a JDBC question. Unless the bean is an EJB question, then it belongs in EJBC.
But to answer. Using JDBC, you have method that takes an integer that is the key, let's say. you create a preparedStatement in which the where clause has a question mark. In the query text it looks like this:
"Select * from table where key = ?"
the statement class I belevie has a method that will substitute the integer you passed to the method in place of the question mark,
you then executre the prepared statement, and it returns a resultSet with the record(s)
Hope this helps
Mark
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic