DropDownList Bind

Sep 9 2017 11:14 AM
public void dropdownlist()
{
string qry = "select * from dept_detail";
SqlDataAdapter sda = new SqlDataAdapter(qry, ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
DataSet ds = new DataSet();
DropDownList2.DataSource = ds;
DropDownList2.DataTextField = "deptname";
DropDownList2.DataValueField = "deptno";
DropDownList2.DataBind();
}
 
Hello, I have a simple questions dropdownlist bind error.
The error is "The iListSource does not contain any data sources"
Connection string - Verified.
Database & Tabel - Verified
Please help me 

Answers (1)