Results 1 to 4 of 4

Thread: Urgent help

  1. #1
    tiger100plus is offline Member
    Join Date
    Nov 2008
    Location
    Kuala Lumpur,Malaysia
    Posts
    16
    Rep Power
    0

    Post Urgent help

    How to use DefaultComboBoxModel by connecting to database(Microsoft Access).....to retrieve studentID(i have no problem in connecting but i need to know how to use this method)

    //DefaultComboBoxModel model=new DefaulltComboBoxModel();
    //JComboBox jcboStud=new JComboBox(model);

    then i don't know how to add the value into the combobox(Student Id)
    please help me becoz i m going to have practical exam very soon...

    advance thanks.....

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  3. #3
    tiger100plus is offline Member
    Join Date
    Nov 2008
    Location
    Kuala Lumpur,Malaysia
    Posts
    16
    Rep Power
    0

    Default Add Item

    in the initialize() method i didn't add addItem but i declare addElement like u see at the bottom

    private void initializeDB(){
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    conTARCollegeDB = DriverManager.getConnection("jdbc:odbc:TARCollegeD S");
    stmtInitialize = conTARCollegeDB.createStatement();
    stmtSearch = conTARCollegeDB.createStatement();
    stmtInsert = conTARCollegeDB.createStatement();
    stmtUpdate = conTARCollegeDB.createStatement();
    stmtDelete = conTARCollegeDB.createStatement();
    rsStudent = stmtInitialize.executeQuery("SELECT StudentID FROM Student;");

    while (rsStudent.next()){
    String studentID = rsStudent.getString(1);
    dcbomStudentID.addElement((Object)studentID);
    }
    }
    }
    catch(Exception ex){
    JOptionPane.showMessageDialog(null, "Error in connecting to database...");
    }
    }

    but i can only retrieve data(Student ID) for combobox...how to retrieve from the other column such as Student Name,CourseID tat match the student ID?thx

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Need help urgent! Is this possible ?
    By meodihia in forum Sun Java Wireless Toolkit
    Replies: 1
    Last Post: 09-28-2008, 09:05 PM
  2. Help. It's urgent
    By monir6464 in forum AWT / Swing
    Replies: 2
    Last Post: 08-24-2008, 05:57 PM
  3. Help me ...urgent!
    By googgoo in forum New To Java
    Replies: 7
    Last Post: 04-05-2008, 08:46 AM
  4. please help urgent
    By ananas7777 in forum AWT / Swing
    Replies: 2
    Last Post: 12-25-2007, 08:30 AM
  5. need urgent help...
    By SCS17 in forum New To Java
    Replies: 1
    Last Post: 11-13-2007, 07:52 AM

Posting Permissions

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