|
-
Display Value in JcomboBox
Hi,
I am new to java.Can u Plz help me.I have a JcomboBox. I want to display all the ItemId from the database in that JComboBox. I don't know how to do that.Can any one plz help me.Can anybody give some sample code
The code is:-
public Iterator selectItemID(){
Iterator itemNo;
ArrayList itemNumber = null;
try {
statement = dbConnection.prepareStatement("select ItemId from ItemDetails");
ResultSet itemNumberResult = statement.executeQuery();
while(itemNumberResult.next())
{
itemNo = (Iterator) itemNumberResult.getString(1);
System.out.println("itemNo " +itemNo);
return (Iterator) itemNo ;
}
} catch (SQLException e) {
e.printStackTrace();
}
return (Iterator) itemNumber;
}
itemno=new JComboBox();
DbActivity dbconnection = new DbActivity();
Iterator result= dbconnection.selectItemID();
itemno.addItem(result);
Regards
Diana
Similar Threads
-
By stephenbs in forum Java
Replies: 0
Last Post: 04-12-2005, 02:27 PM
-
By thebluearcher2 in forum VB Classic
Replies: 0
Last Post: 03-03-2005, 11:38 AM
-
By Allen Pitts in forum XML
Replies: 0
Last Post: 10-31-2002, 03:02 PM
-
By Marat Musaev in forum XML
Replies: 0
Last Post: 11-02-2000, 08:54 AM
-
By joni in forum VB Classic
Replies: 0
Last Post: 07-13-2000, 05:19 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks