Hi,
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!
Hi,
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!
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.
Take a look at either of:
SELECT * FROM sys.columns
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
...anything like what you're after?