Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrieving records using select bean  RSS feed

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • 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!
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • 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
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!