方法一:
1 string sql="SELECT * FROM NewsClass ORDER BY ORDERID DESC";
2
3 OleDbConnection conn=new OleDbConnection();
4
5 conn.ConnectionString=ConnectionString;
6 conn.Open();
7
8 OleDbCommand cmd = new OleDbCommand(Sql,Conn);
9 OleDbDataReader dr= cmd.ExecuteReader();
10
11 //将数据添加到 DropDownList
12 while(dr.Read())
13 {
14 ddl.Items.Add(new ListItem(dr["ClassName"].ToString(),dr["ClassId"].ToString()));
15 }
16 dr.Close();
...[ 查看全文 ]