🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #12486

Re: using JdbComboBox

#12486
From: Alain LACOUR
Date: Mon, 14 Dec 1998 00:00
57 lines
1969 bytes
Hi,

for your EMPTY problem, try something like this :

private void buildComboWithTable(JdbComboBox theCombo, String tableName,
String columnName) {
    try {
      stmt = conn.createStatement();
      rset = stmt.executeQuery("select distinct " + columnName + " from " +
tableName + " order by " + columnName);
      while(rset.next()) {
        theCombo.addItem(rset.getString(1));
      }
      stmt.close();
    }
    catch(Exception e) {
       e.printStackTrace();
    }
  }

where :

Connection conn;
Statment stmt;
ResultSet rset;

Hope it helps.
Alain LACOUR

Jeroen Zwartepoorte wrote:

> Hi,
>
> How do i use a JdbComboBox????
>
> I added it to my app, i set the dataset property and the columnname
> property. But NOTHING HAPPENS when i run the app. The combobox is EMPTY!
>
> I also can't seem to find an example on how to use it.
>
> I remember someone else also having trouble making it work.
>
> And second: let's say the data that i want to show in a JdbComboBox is
> of the form: data1;data2;data3
> (the data is in one field, with the values separated by ;)
>
> Now, when i want to show this in a JdbComboBox, what do i have to do?
>
> Do i need to write my own ComboBoxModel?
>
> I looked at the JdbComboBox source, but i didn't understand how it get's
> the data from the dataset.
>
> Hope you can help me,
>
> Jeroen Zwartepoorte
> Jeroen@xs4all.nl
Technical Details
Message-ID: <36750452.E538E24@mhinformatics.ch>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3674E09D.5F0EF8E8@xs4all.nl>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,d70ee309a476f00b
X-Google-Attributes: gid111d45,public
From: Alain LACOUR <alain.lacour@mhinformatics.ch>
Subject: Re: using JdbComboBox
Date: 1998/12/14
Message-ID: <36750452.E538E24@mhinformatics.ch>
X-Deja-AN: 422101166
Content-Transfer-Encoding: 7bit
References: <3674E09D.5F0EF8E8@xs4all.nl>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: M&H Informatics AG
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing