在 Default.aspx 窗体中添加一个 DropDownList 控件命令为 DropDownList1 ,该控件通过后台代码绑定用于显示新闻标题列表。这里使用 Sqlweb News 数据库中的 News 表,新闻标题字段为 Title 。下面在后台代码中添加一个 DropDownListBind() 方法实现 DropDownList1 绑定,根据程序要求,补充空白处的代码。 protected void DropDown List Bind(){ string strcnn = ConfigurationManager.ConnectionStrings ["Sqlweb News "].ConnectionString; SqlConnection cnn = new SqlConnection(strcnn); SqlDataReader dr = null; try{ cnn.Open( ); SqlCommand cmd = new____________ ("select * from News", ____ ); dr = cmd . _________ ; while (dr. _____ ){ DropDownList1.Items.Add(dr[" ____ "].ToString()); } } finally{ if (dr != null) dr.Close( ); if (cnn != null) cnn.Close( ); } }