【发布时间】:2014-12-22 13:54:53
【问题描述】:
我正在使用 SQL 服务器,并且在我的程序中我目前正在使用这样的计数:
Function NumberOfApplications(inCandidateID As Integer) As Integer
Dim iCount As Integer = 0
Dim oApplication As DataModels.Application
For Each oApplication In Me.Applications
If oApplication.CandidateID = inCandidateID Then
iCount = iCount + 1
End If
Next
Return iCount
End Function
我已经创建了我的实体并购买了正确的 Imports,但我需要知道如何使用 LINQ 和 VB 执行计数。正如您在上面看到的,我正在使用候选 ID 进行计数。任何帮助,将不胜感激。谢谢。
【问题讨论】:
-
类似于 Me.Applications.Select (s=>s.CandidatId).Distinct.Count() 的东西
标签: sql-server vb.net linq-to-sql