System.Generic.IEnumerable 集合的 ASP.Net LINQ to SQL 语法分组
.Net 应用程序调用存储过程并返回存储为“结果”的集合。我希望能够按“CreatorLineOfBusinessID”对结果进行分组。它返回该字段以及其他几个字段。我想对“结果”数据集使用 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)
.Net application calls Stored Procedure and returns collection which is stored as 'result.' I want to be able to group the results by 'CreatorLineOfBusinessID'. It returns that field along with several other fields. I would like to use a LINQ query on the 'result' data set. Thanks in advance.
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您对 Linq 分组进行过研究吗?请尝试此处的 101 个示例:http://msdn.microsoft.com/en-us/vstudio /bb688088
然后只需使用 Key 和属性 Referrals 迭代
orderGroups
即可IEnumerable
Have you done any research on Linq grouping? Try the 101 examples here: http://msdn.microsoft.com/en-us/vstudio/bb688088
Then just iterate over
orderGroups
using the Key and the property Referrals which will be anIEnumerable<eRefer_Reports.uspReport_ReferralsSentBetweenLinesOfBusinessResult>
应该按照您想要的方式对结果进行分组。
Should group the results the way you want.