测试通过,完整代码如下: using System; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Collections.Generic; namespace WebApplication1 { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string constr ="Data Source=.;Initial Catalog=test;Persist Security Info=True;User ID=sa;Password=scott"; string cmdstr = "SELECT top 1* FROM sales"; SqlConnection con = new SqlConnection(constr); con.Open(); SqlCommand cmd = new SqlCommand(cmdstr, con); DataTable MyTable = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmdstr, con); da.Fill(MyTable); List<Entity> list = new List<Entity> (); Entity entity = new Entity (); entity.Id = Convert.ToInt32( MyTable.Rows[0]["monthid"]); entity.SalesId = Convert.ToInt32( MyTable.Rows[0]["salescount"]); list.Add(entity); //使用Linq语句 var q = from p in list select new { p.Id, p.SalesId }; GridView1.DataSource = q; GridView1.DataBind(); } } //实体 public class Entity { private int _id; public int Id { get { return _id; } set { _id = value; } } private int _salesId; public int SalesId { get { return _salesId; } set { _salesId = value; } } } }