Results 1 to 7 of 7
  1. #1
    tunali2 is offline Member
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default Request help for retrieving data from Access

    I have 3 text boxes for StudentID, StudentName and ClearanceStatus. I want to retrieve StudentName and ClearanceStatus from an Access database based on the StudentID which should be entered by the user as the user clicks Go button. Please help!

  2. #2
    UJJAL DHAR is offline Senior Member
    Join Date
    Apr 2010
    Location
    Dhaka,Bangladesh
    Posts
    180
    Rep Power
    0

    Default

    Quote Originally Posted by tunali2 View Post
    I have 3 text boxes for StudentID, StudentName and ClearanceStatus. I want to retrieve StudentName and ClearanceStatus from an Access database based on the StudentID which should be entered by the user as the user clicks Go button. Please help!
    Firstly keep StudentName and ClearanceStatus on a DATABASE,then retrieve them and show them on the GUI when it starts..

    More specifically ask your questions.

    Regards
    Ujjal
    Don't Forget to try yourself before asking others help.....
    Press REP, if you find their advices/solutions effective.

  3. #3
    tunali2 is offline Member
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default

    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?

  4. #4
    UJJAL DHAR is offline Senior Member
    Join Date
    Apr 2010
    Location
    Dhaka,Bangladesh
    Posts
    180
    Rep Power
    0

    Default

    Quote Originally Posted by tunali2 View Post
    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?
    Let your button name is GO.Then use actionlistener.
    Java 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);
    
      }}
    );
    For an example
    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.

  5. #5
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    6

    Default

    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?

  6. #6
    tunali2 is offline Member
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default

    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!

  7. #7
    UJJAL DHAR is offline Senior Member
    Join Date
    Apr 2010
    Location
    Dhaka,Bangladesh
    Posts
    180
    Rep Power
    0

    Default

    Quote Originally Posted by tunali2 View Post
    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!
    What do you think I have told you?
    Already I have given the answer.

    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
    What do you want now? How can we help you more than this?
    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

  1. Retrieving data from database every 10 secs.
    By vnsuresh.abi in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 03-31-2011, 11:14 AM
  2. retrieving data from token
    By bozovilla in forum Advanced Java
    Replies: 4
    Last Post: 09-30-2010, 08:49 AM
  3. Store data is not retrieving
    By JavaJunkie in forum CLDC and MIDP
    Replies: 2
    Last Post: 05-30-2009, 08:08 AM
  4. error while retrieving data from data base
    By kirtesh4u in forum New To Java
    Replies: 5
    Last Post: 11-15-2008, 04:10 PM
  5. Retrieving data from the DB
    By yuchuang in forum JDBC
    Replies: 2
    Last Post: 11-27-2007, 08:59 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •