Unable to bind LINQ to gridview

前端 未结 3 1677
隐瞒了意图╮
隐瞒了意图╮ 2021-01-28 00:43

I just using a simple LINQ query having group by clause and trying to bind its result set to GridView. My LINQ query looks like

var expData = from c in WebDB.Tra         


        
3条回答
  •  北荒
    北荒 (楼主)
    2021-01-28 01:25

    expData is a string as you've put the LINQ query inside quotation marks.

    var expData = "from c in WebDB.TransTable
                group c by c.enterdate into g
                  select g;"
    

    System.String does not have a property called Key, hence the error.

    If you remove the quotation marks it should all work fine.

提交回复
热议问题