使用以下查询
Dim allEvents As New List(Of Events)
Dim digits = "1 2 3 4 5 6 7 8 9 0".Split()
Dim results = (From t In ctx.events
Where t.date = todaysdate.Date AndAlso
Not digits.Any(Function(d) (t.symbol.Contains(d)))
Order By t.time
Select New With {
t.symbol,
t.date, t.time,
t.description,
t.domestic_call_num,
t.web_url})
If results.Count > 0 Then
For x As Integer = 0 To results.Count - 1
Dim newevent As New Events
With newevent
.CompanySymbol = results(x).symbol
.EventDate = results(x).date
.EventTime = Left(results(x).time.ToString(), 5)
.EventDescription = results(x).description
If results(x).domestic_call_num IsNot Nothing Then
.DialInNumber = results(x).domestic_call_num
Else
.DialInNumber = ""
End If
If results(x).web_url IsNot Nothing Then
.WebCastUrl = results(x).web_url
Else
.WebCastUrl = ""
End If
End With
allEvents.Add(newevent)
Next
Return allEvents
我得到了我想要的结果,但我想按描述和时间进一步排序
我尝试了以下,这应该有效
Dim results = (From t In ctx.events
Where t.date = todaysdate.Date AndAlso
Not digits.Any(Function(d) (t.symbol.Contains(d)))
Order By t.time
Group By t.description
Select New With {
t.symbol,
t.date, t.time,
t.description,
t.domestic_call_num,
t.web_url})
我还尝试了编译器不喜欢的 ThenBy。任何有关如何实现此目的的帮助将不胜感激。本质上,我想要一个时间排序,然后是描述,然后是符号。