Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8321661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:05:44+00:00 2026-06-08T23:05:44+00:00

I have an MS Access database, in which there is a set of tablet

  • 0

I have an MS Access database, in which there is a set of tablet names in column name ‘tname’. I have 5 comboboxes in java applet. All the 5 comboboxes must update the items in tname, each time when it loads. I used the following code. It adds only the first item in tname to the first combobox only. Other boxes remain empty. But if I update a single combobox, it works. But I need 5 comboboxes to get updated. Kindly guide me through the problem I’ve made.

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn9=DriverManager.getConnection("jdbc:odbc:vasantham","","");
Statement st9=conn9.createStatement();
ResultSet rs9=st9.executeQuery("select DISTINCT tname from try");

while(rs9.next())
{
  ct19.addItem(rs9.getString("tname"));
  ct29.addItem(rs9.getString("tname"));
  ct39.addItem(rs9.getString("tname"));
  ct49.addItem(rs9.getString("tname"));
  ct59.addItem(rs9.getString("tname"));
}


conn9.close();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T23:05:46+00:00Added an answer on June 8, 2026 at 11:05 pm

    I have tried, it works all fine as i was wondering what is the need to have a temp variable look at my code, its fully working code

    import java.awt.FlowLayout;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    
    public class ResultSetDemo {
    
        public ResultSetDemo() {
            JFrame f = new JFrame();
            f.setLayout(new FlowLayout());
            JComboBox cb1 = new JComboBox();
            f.add(cb1);
            JComboBox cb2 = new JComboBox();
            f.add(cb2);
            JComboBox cb3 = new JComboBox();
            f.add(cb3);
            JComboBox cb4 = new JComboBox();
            f.add(cb4);
            JComboBox cb5 = new JComboBox();
            f.add(cb5);
    
            try {
                Class.forName("com.mysql.jdbc.Driver");
                Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/database_name", my_sql_username, mysql_password);
                Statement st = con.createStatement();
                ResultSet rs = st.executeQuery("select DISTINCT tname from try");
                while (rs.next()) {
                    cb1.addItem(rs.getString("tname"));
                    cb2.addItem(rs.getString("tname"));
                    cb3.addItem(rs.getString("tname"));
                    cb4.addItem(rs.getString("tname"));
                    cb5.addItem(rs.getString("tname"));  
    
                }
            } catch (Exception ex) {
                System.out.println(ex);
            }
    
            f.setSize(600, 100);
            f.setVisible(true);
    
        }
    
        public static void main(String[] args) {
            new ResultSetDemo();
        }
    }
    

    it populates cboxes with all rows in table

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In an application we are developing, I have access to a database table which
I have this old Access database (2000 format) which i want to convert to
I have an Access application which use SQLServer 2008 R2 as database. When I
I have a database connection which takes an input from the querystring to access
I have a local Database running on localhost:3306, which I access with MySQL Workbench.
I have 2 computers each having a MS Access database, same set of tables
I have a vbscript which does the following: Open an access 2003 database Run
I have a set of XSDs from which I generate data access classes, stored
I have multiple apps running which access a sql server database. I had initially
I have 4 views in my MS Sql Server Database which are all quite

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.