Results 1 to 2 of 2

Thread: building cbo boxes

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    7

    building cbo boxes

    what am I doing wrong?

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
    OleDbConnection1.Open()
    OleDbDataAdapter1.SelectCommand.CommandText = "SELECT Location, HotelID FROM Hotel"
    OleDbDataAdapter1.SelectCommand.ExecuteNonQuery()
    Do

    ComboBox1.Items.Add(OleDbDataAdapter1.SelectCommand.CommandText)

    Loop
    OleDbConnection1.Close()
    End Sub

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    what am I doing wrong
    Calling ExecuteNonQuery to execute the Select statement (which is a query).
    Adding the same value to the combobox each time.
    There is an endless loop.

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