我只是使用了一个简单的LINQ查询,它具有group by子句并试图将其结果集绑定到GridView。 我的LINQ查询看起来像ASP.NET页面无法将LINQ绑定到gridview
<asp:GridView ID="GridView1" AutoGenerateColumns="true" runat="server" DataKeyField="Key" />
但得到的错误上
var expData = from c in WebDB.TransTable
group c by c.enterdate into g
select g;
网格视图:
A field or property with the name 'Key' was not found on the selected data source.
任何人都可以帮我吗?
没有一个答案是有帮助的
你需要从linq语句中移除''''''''将它视为一个字符串。 – 2011-05-17 09:42:01