你把完整代码发出来看看
程序代码:
if(!this.IsPostBack)
{
SqlConnection meteor = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["meteor"]);
meteor.Open();
SqlCommand comm = new SqlCommand("select * from studentinformation", meteor);
SqlDataReader sdr = comm.ExecuteReader();
ListBox1.DataSource = sdr;
ListBox1.DataTextField = "studentname";
ListBox1.DataValueField = "studentnum";
ListBox1.DataBind();
sdr.Close();
meteor.Close();
}