List<UserInfo> UserInfoList= new List<UserInfo> while(reader.Read()) { UserInfo userinfo = new UserInfo(); userinfo.Age = reader["Age"].ToString(); userinfo.Sex= reader["Sex"].ToString(); UserInfoList.add(userinfo); } GridView1.DataSource = UserInfoList; GridView1.DataBind()
SQLDataReaderToList 数据读取器转换到List
原文:https://www.cnblogs.com/lishiyiya/p/13704698.html