We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,617 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Get column from database to combo box

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

5
Contributors
4
Replies
2 Days
Discussion Span
1 Year Ago
Last Updated
5
Views
Iamateur
Junior Poster in Training
78 posts since Apr 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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?

hericles
Veteran Poster
1,065 posts since Nov 2007
Reputation Points: 156
Solved Threads: 228
Skill Endorsements: 10

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

Mitja Bonca
Posting Maven
2,561 posts since May 2009
Reputation Points: 642
Solved Threads: 486
Skill Endorsements: 15

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

M.Waqas Aslam
Master Poster
759 posts since Aug 2011
Reputation Points: 58
Solved Threads: 126
Skill Endorsements: 2

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.

Begginnerdev
Practically a Posting Shark
893 posts since Apr 2010
Reputation Points: 198
Solved Threads: 149
Skill Endorsements: 9

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0651 seconds using 2.67MB