How to get get complete column from database to combo box ?

Recommended Answers

All 4 Replies

If you want to get all of the rows out of a database for a particular column use either a dataReader or a dataAdapter to hold the result of your SQL statment (SELECT column_name FROM database;) and then loop through the reader or adapter adding each item to the combo box.

Is there a particular part of the problem you are having trouble with?

This question has been asked a couple of times. Please do NOT duplicte threads. One will be just fine.
Close this one.

well , this is very simpele , you can do like this

dim con as new sqlconnection("your connection string")
con.open()
dim da as new sqldataadapter("select columnName from table",con)
dim dt as new datatable()
da.fill(dt)
combobox1.datasource = dt 
combobox1.displaymember = "columnName"
combobox1.valuemember = "ColumnName"
con.Close()

hope this will help you.

Best regards

I have this feeling that Iamature is begging for homework.

As Mitja stated, he has posted the same question, re worded, at least twice.

He also PM'ed me, asking for me to code his project for him.

I don't mind helping, but doing the work for someone is a different story.

Give a man a fish, he will eat for a day. Teach a man to fish, he will eat for a lifetime.

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.