I get the above error when i try to debug this code.
protected void Page_Load(object sender, EventArgs e)
{
\
string strID = DropDownList1.SelectedValue;
SqlConnection conn = new SqlConnection("Data Source=****;Initial Catalog=sample;User ID=*****;Password=********");
String sql = "SELECT sname FROM student WHERE sclass ='" + strID + "'";
SqlDataAdapter ad = new SqlDataAdapter(sql, conn);
DataTable dt = new DataTable();
ad.Fill(dt);
if (dt.Rows.Count > 0)
{
DropDownList2.Items.Clear();
DropDownList2.Items.Add("Select");
for (int i = 0; i < dt.Rows.Count; i++)
{
string item = dt.Rows[i]["sclass"].ToString();
DropDownList2.Items.Add(item);
}
}
}