【发布时间】:2011-11-29 20:40:14
【问题描述】:
.Net 应用程序调用存储过程并返回存储为“结果”的集合。我希望能够按“CreatorLineOfBusinessID”对结果进行分组。它返回该字段以及其他几个字段。我想对“result”数据集使用 LINQ 查询。提前致谢。
Dim result As IEnumerable(Of eRefer_Reports.uspReport_ReferralsSentBetweenLinesOfBusinessResult)
strFromLOBID = " "
Session("FromLineOfBusiness") = strFromLOBID
strToLOBID = " "
Session("ToLineOfBusiness") = strToLOBID
result = repository.GetQueryResults(CDate(Me.txtStartDate.Text), CDate(Me.txtEndDate.Text), strFromLOBID, strToLOBID)
BindGridView(result)
【问题讨论】:
-
正如
Lcarus所指出的,您不需要使用 LINQ 来进行此分组。因为您的结果已经是IEnumerable<uspReport_ReferralsSentBetweenLinesOfBusinessResult>,您也可以使用 GroupBy 方法。 -
@Susan 你过得怎么样?您能否将报告分组?
-
抱歉,已经有一段时间了,但一直在度假。我在语法上苦苦挣扎。我正在尝试:BindGridView(result.GroupBy(CreatorLineOfBusinessID)),但这不起作用。对不起,我是个新手!
标签: asp.net linq-to-sql group-by