how to store all items of database to combo box.
i.e. store complete column in combo box?
Iamateur 0 Junior Poster in Training
Recommended Answers
Jump to PostLike:
Using conn As New SqlConnection("connString") Using cmd As SqlCommand = New SqlComand("SELECT ColumnName FROM TableName", conn) Using reader As SqlDataReader = cmd.ExecuteReader() While reader.Read() comboBox1.Items.Add(reader(0).ToString()) End While End Using End Using End Using
Jump to PostSure it does, you must have the correct connection string of your database. Are you sure you have one?
Which is exactly your database?To answer on your last question, myComboBox is a reference (a reference name) to your ComboBox control.
When you create (instanitate) new comboBox control you do:
…
All 7 Replies
Mitja Bonca 557 Nearly a Posting Maven
G_Waddell 131 Posting Whiz in Training
Iamateur 0 Junior Poster in Training
Iamateur 0 Junior Poster in Training
Iamateur 0 Junior Poster in Training
Iamateur 0 Junior Poster in Training
Mitja Bonca 557 Nearly a Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.