SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["sql2005"].ConnectionString);
SqlDataAdapter adp = new SqlDataAdapter(); adp.SelectCommand.Connection = con; adp.SelectCommand.CommandType = CommandType.Text; adp.SelectCommand.CommandText = "SELECT id,name,pwd,class,age FROM member";
提示con对象为空
改成这样试试
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["sql2005"].ConnectionString);
SqlCommand cmd = con.CreateCommand();
cmd.CommandText = "SELECT id,name,pwd,class,age FROM member";
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
con.Open();
adp.Fill(ds);
con.Close();