locked
Bind a dropbox to unique values in a table RRS feed

  • Question

  • I've done this with an ASP page but not exactly sure how to with SQLCE /VB

    Can I just bind the contents of a dropbox to this statement or do i need

    to use a movenext command and stuff into an array?

     

     

    strQuery = "SELECT DISTINCT catagory FROM numbers;"

    Set RS1 = conn1.Execute(strQuery) 

     

    • Edited by Rjl66 Friday, May 14, 2010 6:20 PM make more clear
    Friday, May 14, 2010 5:49 PM

Answers

  • Rjl66,

    There are a couple of ways to do it.  I would try the following:

    strQuery = "select distinct catagory from numbers"

    Dim adp as SqlDataAdapter = New SqlDataAdapter(strQuery, connectionObj)

    Dim dt as New DataTable

    adp.Fill(dt)

    comboBox1.DataSource = dt

    comboBox1.DisplayMember = "catagory"

     


    Michael Scott
    Friday, May 14, 2010 10:33 PM