Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database query from JFrame

Status
Not open for further replies.

johnv20

Programmer
Sep 26, 2001
292
US
Hi,
I am very new to Java programming so please excuse me if this is a very inane question

I have a JTextField which takes in user input as variable response1, I also have a block of code which then runs the sql statement just entered - how do I pass the variable reponse1 from the pane to the object which runs the database side ?

Thanks
 
Retrieve the text and store it in a String object thus :

JTextField jtf = new JTextField();
Code:
String response1 = jtf.getText();

How you return this String to your SQL will depend on how you have written your JDBC classes and GUI classes, and how you invoke your objects etc.

Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top