Connecting Tech Pros Worldwide Help | Site Map

java swings problem

Newbie
 
Join Date: Jul 2008
Posts: 1
#1: Jul 10 '08
hi i am developing a gui in java swings and i am getting my database displayed in jtable...
i have a textfield labeled CUSTID and my table also has its sec column as CUSTID (which is not a primary key)............i want that when i write a value in that textfield then, only those rows with that value of custid gets displayed in my jatable in my gui...
plz can anyone help me??
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#2: Jul 10 '08

re: java swings problem


So if there is no text in your JTextField you'd have to use a sql statement like this:
"select * from yourtable", otherwise use a PreparedStatement like this one:
"select * from yourtable where CUSTID = ?" and fill in the ? parameter with the
value from obtained your JTextField. An ActionListener registered to that field
should start the job.

kind regards,

Jos

ps. btw, the name is 'Swing' not 'swings'
Reply