Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show Default Model Year

Status
Not open for further replies.

DB2Problem

Programmer
Oct 17, 2002
53
US
Hello All,

I have a Java code which fetches SQL to populate the drop down box.

SQL is returning result in this order -

year_code year_description
5 2005
4 2004
3 2003
2 2002

The drop down build from the java program is showing the same order

However, I want to show the order like

2004
2005
2003
2002

How can I default the year code to 2004 when the SQL is returning the above order

What change I may need to incorporate in Java code or SQL ?? A code snippet will expedite and help me a lot.

Thanks for your feedback
 
Look for a set default method or select method in the ListBox you are using. I have an example for Java.Awt.Choice where you would populate the List with your output from the DB and then you need to develop some sort of method of determining which element you wish to select using:
Code:
 populate(myChoiceBox);
 (myChoiceBox).select("2004");  //(myChoiceBox).select(2);
Where you could put "2004" if that is what you want or use an index if you can find out how to determine it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top