加载不上数据集的内容,问题出在哪儿呢?
以下语句可以执行,但是lindse中加载不上数据集的内容,问题出在哪儿呢?麻烦各位前辈帮忙解决一下,谢谢!
代码如下:
//partse和lindse都是dropdownlist的名字
string par = partse.SelectedValue;
string sel = "select name from e_evalumap where department='"+par+"'";
string connectionString = ConfigurationManager.ConnectionStrings["renshi"].ConnectionString;
SqlConnection mycon = new SqlConnection(connectionString);
mycon.Open();
SqlCommand mycom = new SqlCommand(sel, mycon);
SqlDataReader dr = mycom.ExecuteReader();
while (dr.Read())
{
lindse.Items.Add(new ListItem( dr.ToString()));
}