帮我看下 怎么dropDownlist不显示数据

来源:百度知道 编辑:UC知道 时间:2024/07/07 02:13:39
string bianhao = TextBox1.Text;
string mingcheng = TextBox2.Text;
string jieshao = Request.Form["content1"];
string renyuan = TextBox3.Text;
string shebei = TextBox4.Text;
string lianxi = TextBox5.Text;
string yiyuanbianhao = TextBox6.Text;
SqlConnection conn = new SqlConnection("server=localhost;database=h204223;uid=sa;pwd=sa ");
conn.Open();
string strsql1 = "select * from class where class ='health_class'";
SqlDataAdapter apt = new SqlDataAdapter(strsql1, conn);
DataSet ds = new DataSet();
apt.Fill(ds,"asd1");
DropDownList1.DataSource = ds.Tables["asd1"].DefaultView;
DropDownList1.DataTextField = "name";
DropDownList1.DataValueField = "id";

程序是没问题的。把这句在查询分析器下执行下看有结果吗?string strsql1 = "select * from class where class ='health_class'";

你确定从数据库里面查询到结果出来了吗