Results 1 to 3 of 3

Thread: [RESOLVED] How to get unique values in comboboxes

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2005
    Posts
    43

    Resolved [RESOLVED] How to get unique values in comboboxes

    I'm adding valus to a combo box from a table column in a database. The values in the column are not unique meaning there are rows with same values. I would like th combobox to only have one of each value. Can anyone help? I'm using the code below.

    VB Code:
    1. With OraDynaset
    2.     If .RecordCount <> 0 Then
    3.         Do While Not .EOF
    4.        
    5.             cboDefLine.AddItem .Fields("Line_ID")
    6.         .MoveNext
    7.         Loop
    8.     End If

  2. #2
    Hyperactive Member
    Join Date
    Dec 2004
    Posts
    308

    Re: How to get unique values in comboboxes

    Is there no way the SQL for the combo could just return unique values ? Much simpler that way..

    Chubby..

  3. #3
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: How to get unique values in comboboxes

    Use SELECT DISTINCT in your sql...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width