我只是使用了一個簡單的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