Results 1 to 3 of 3
  1. #1
    Java.child is offline Member
    Join Date
    Sep 2008
    Posts
    32
    Rep Power
    0

    Default want default value in ComboBox from DB!!

    Hi Friends,
    Code of my project is in Swing.
    I want a default value in combobox which is retreiving data from DB.How can I do that?
    Below in the sample code from the proj.

    dataLastOne.setName( "dataLastOne" );
    add( dataLastOne );
    dataLastOne.setCaption( "dataLastOne" );
    dataLastOne.setConnectionTimeout( 15 );
    dataLastOne.setCommandTimeout( 30 );
    dataLastOne.setCursorType( AdoConst.adOpenForwardOnly );
    dataLastOne.setLockType( AdoConst.adLockOptimistic );
    dataLastOne.setCommandType( AdoConst.adCmdText );
    dataLastOne.setMaxRecords( 0 );
    dataLastOne.setBOFAction( CtrlConst.adDoMoveFirst );
    dataLastOne.setEOFAction( CtrlConst.adDoMoveLast );
    dataLastOne.setConnectionString( "jdbcdbc:lynx", MISECRETO, MISECRETOTwo, "sun.jdbc.odbc.JdbcOdbcDriver" );

    dataLastOne.setConnectionString( "", "" );
    dataLastOne.setEnabled( true );
    dataLastOne.setUserName( "" );
    dataLastOne.setPassword( "" );

    dataLastOne.setRecordSource( "SELECT [LastUsedSkill].[LastUsed] FROM LastUsedSkill WHERE [LastUsedSkill].[LastUsedSort]>=2002 And [LastUsedSkill].[LastUsedSort]<=2008 ORDER BY [LastUsedSkill].[LastUsed] DESC; " );

    dataLastOne.showAddNewButton( true );
    dataLastOne.setVisible( false );
    dataLastOne.setLocation( 200, 769 );
    dataLastOne.setSize( 180, 22 );
    Data.initControls( dataLastOne );


    Thanks !!

  2. #2
    Java.child is offline Member
    Join Date
    Sep 2008
    Posts
    32
    Rep Power
    0

    Default Fetch value from the DB and set it as default value !!!

    Hi Friends,
    I guess I am not explaining my problem in a right way to experts.
    I am using Swing.
    I am fetching data from the database and storing it in the combobox.I want one default value in the combobox which comes from the database.I am not able to find out that property which fetches value from the DB and set one of them as default value.
    Please somebody helps me.

    Here is the code:-


    dataSkillOne.setName( "dataSkillOne" );
    add( dataSkillOne );
    dataSkillOne.setCaption( "dataSkillOne" );
    dataSkillOne.setConnectionTimeout( 15 );
    dataSkillOne.setCommandTimeout( 30 );
    dataSkillOne.setCursorType( AdoConst.adOpenForwardOnly );
    dataSkillOne.setLockType( AdoConst.adLockOptimistic );
    dataSkillOne.setCommandType( AdoConst.adCmdText );
    dataSkillOne.setMaxRecords( 0 );
    dataSkillOne.setBOFAction( CtrlConst.adDoMoveFirst );
    dataSkillOne.setEOFAction( CtrlConst.adDoMoveLast );
    dataSkillOne.setConnectionString( "jdbc:odbc:lynx", MISECRETO, MISECRETOTwo, "sun.jdbc.odbc.JdbcOdbcDriver" );
    dataSkillOne.setConnectionString( "", "" );
    dataSkillOne.setEnabled( true );
    dataSkillOne.setUserName( "" );
    dataSkillOne.setPassword( "" );
    dataSkillOne.setRecordSource( "SELECT [MidClientSkills].[Skill], [MidClientSkills].[SkillSort] FROM MidClientSkills WHERE [MidClientSkills].[Skill]<>'ALL' GROUP BY [MidClientSkills].[Skill], [MidClientSkills].[SkillSort] ORDER BY [MidClientSkills].[SkillSort]; " );
    dataSkillOne.showAddNewButton( true );
    dataSkillOne.setVisible( false );
    dataSkillOne.setLocation( 200, 769 );
    dataSkillOne.setSize( 180, 22 );
    Data.initControls( dataSkillOne );

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,318
    Rep Power
    25

    Default

    What kind of combo box are you using? Which class?
    Hard to lookup in the API doc without that.

Similar Threads

  1. ComboBox with CheckBoxes
    By heba.farouk in forum AWT / Swing
    Replies: 14
    Last Post: 06-09-2010, 11:03 AM
  2. want default value in ComboBox !!
    By Java.child in forum SWT / JFace
    Replies: 0
    Last Post: 09-29-2008, 09:57 PM
  3. combobox
    By chandu.v in forum New To Java
    Replies: 2
    Last Post: 07-02-2008, 08:36 PM
  4. ComboBox Fix Width
    By Azndaddy in forum New To Java
    Replies: 2
    Last Post: 05-29-2008, 04:23 AM
  5. HashMap and ComboBox
    By banie in forum AWT / Swing
    Replies: 2
    Last Post: 03-25-2008, 11:58 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
  •