注:ds为DataSet DataTable table=ds.Tables["mytable"]; foreach(DataRow row in table.Rows) { mylist.Items.Add(new ListItem(row[1].ToString(),row[0].ToString())); }也可以用 mylist.DataSource=ds.Tables["mytable"].DefaultView; mylist.DataTextField="tname"; mylist.DataValueField="tid"; mylist.DataBind(); 注:BindList()最好写在OnInit中 Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); myConn=new SqlConnection(strConn); base.OnInit(e); BindList(); } 转载于:https://www.cnblogs.com/higou/archive/2004/09/04/39598.html