checkBoxList

来源:互联网 发布:手机版五笔打字软件 编辑:程序博客网 时间:2024/05/11 22:04
// C#
private void Page_Load(object sender, System.EventArgs e)
{
   if (! this.IsPostBack)
   {
      sqlConnection1.Open();
      sqlCommand1.CommandText = "Select au_id, au_lname from authors";
      ListBox1.DataSource = sqlCommand1.ExecuteReader();
      ListBox1.DataTextField = "au_lname";
      ListBox1.DataValueField = "au_id";
      ListBox1.DataBind();
      sqlConnection1.Close();
   }
}
原创粉丝点击