使用dataset或datareader绑定控件(以dataset为例)
SqlDataAdapter da =
new SqlDataAdapter("select id,name from hy",conn);
DataSet ds =
new DataSet();
da.Fill(ds);
conn.Close();
DropDownList1.DataSource = ds.Tables[0];
DropDownList1.DataTextField=
"name";
DropDownList1.DataValueField =
"id";