Results 1 to 7 of 7
- 04-03-2011, 11:05 AM #1
Member
- Join Date
- Apr 2011
- Posts
- 4
- Rep Power
- 0
- 04-03-2011, 11:56 AM #2
Senior Member
- Join Date
- Apr 2010
- Location
- Dhaka,Bangladesh
- Posts
- 178
- Rep Power
- 0
Don't Forget to try yourself before asking others help.....
Press REP, if you find their advices/solutions effective.
- 04-03-2011, 12:15 PM #3
Member
- Join Date
- Apr 2011
- Posts
- 4
- Rep Power
- 0
I already created the database in access with all three fields in a table called Status. I need help with the coding for the GO button on the GUI. When the user enters the ID in the text box and clicks GO, the program should check the ID number in the txt_id text box and retrieve the corresponding student name and his status from the database and display. How do I write the code to do that?
- 04-03-2011, 02:39 PM #4
Senior Member
- Join Date
- Apr 2010
- Location
- Dhaka,Bangladesh
- Posts
- 178
- Rep Power
- 0
Let your button name is GO.Then use actionlistener.
For an exampleJava Code:Go.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { //write your code here which will be executed when pressing the button// Step 1: String id=checkbox.getText(); Step 2:connect with Database Step 3:execute "SELECT *from tablename where columnname=id" Step 4: here you will get values of the table like String StudentName =statement.getText(columnnumber); }} );
http://ujjalruet.wordpress.com/2011/...mysql-in-java/Last edited by UJJAL DHAR; 04-03-2011 at 03:10 PM.
Don't Forget to try yourself before asking others help.....
Press REP, if you find their advices/solutions effective.
- 04-03-2011, 03:42 PM #5
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,604
- Rep Power
- 5
Suggested reading...How To Ask Questions The Smart Way
We're left guessing about the details of the problem without a more thorough description - asking "how do I do that?" is difficult to answer, as there are typically several ways - providing context, code, etc..will get your question answered much faster. Break the problem down - at what point are you stuck? Gui design? Database access? Listener implementation?
- 04-03-2011, 09:36 PM #6
Member
- Join Date
- Apr 2011
- Posts
- 4
- Rep Power
- 0
I have 3 fields; ID, name and status on Java GUI. I am using Access database and there is connection. I want the user to be able to search using ID and retrieve the name and status. Please help!
- 04-04-2011, 07:59 AM #7
Senior Member
- Join Date
- Apr 2010
- Location
- Dhaka,Bangladesh
- Posts
- 178
- Rep Power
- 0
What do you think I have told you?
Already I have given the answer.
What do you want now? How can we help you more than this?String id=checkbox.getText();
ResultSet result =mysql_query ("Select *from tableName where idcolumn=id ");
String name=result.getString(1);
String status=result.getString(2);
//here 1 and 2 means column name
I have given a link,did you see this?Don't Forget to try yourself before asking others help.....
Press REP, if you find their advices/solutions effective.
Similar Threads
-
Retrieving data from database every 10 secs.
By vnsuresh.abi in forum JavaServer Pages (JSP) and JSTLReplies: 4Last Post: 03-31-2011, 11:14 AM -
retrieving data from token
By bozovilla in forum Advanced JavaReplies: 4Last Post: 09-30-2010, 08:49 AM -
Store data is not retrieving
By JavaJunkie in forum CLDC and MIDPReplies: 2Last Post: 05-30-2009, 08:08 AM -
error while retrieving data from data base
By kirtesh4u in forum New To JavaReplies: 5Last Post: 11-15-2008, 04:10 PM -
Retrieving data from the DB
By yuchuang in forum JDBCReplies: 2Last Post: 11-27-2007, 08:59 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks