Reputation: 1
I have a database in SQL Server with a table that has 18 columns. I want to create a drop down list in visual studio 2008 that will display each of these column names and be data bound. Is this possible, and if so, how?
Thanks!
Upvotes: 0
Views: 1328
Reputation: 25008
Take a look at either of:
SELECT * FROM sys.columns
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
...anything like what you're after?
Upvotes: 0
Reputation: 748
select column_name from information_schema.columns
where table_name = 'YourTableName'
order by ordinal_position
This will pull the data that you're looking for and all that's left is binding it to your drop down list.
Upvotes: 1