I am able to bind my dropdownlist with the following lines of code.
Current Scenario : DropDownList bounded with all the column names of that table.
Requirement: DropDownList to be bounded with only specific column names of the table.
How to achieve this in SQL query in client side ?
private void BindDropDownLists()
{
SqlDataSource.ConnectionString = connection;
SqlDataSource.SelectCommand = "SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE (TABLE_NAME = 'MyTable')";
**// Only specific columns needed as DDL input.**
**// I Used AND COLUMN_NAME = 'Mycolumnname' it worked but how to hardocore specifc set of column names**
//DropDownList5.DataSource = SqlDataSource;
DropDownList5.DataTextField = "COLUMN_NAME";
DropDownList5.DataValueField = "DATA_TYPE";
DropDownList5.DataBind();
}