我正在使用 Linq to SQL 框架(DBML 文件)使用以下查询。这是来自上一个问题 - LINQ 中的内部联接无法正常工作。
该Order By
部分似乎不起作用。它只是按标题排序,然后按开始日期排序。我怎样才能让查询仅在开始日期之前订购?
Dim ds = From tds In db.tbl_tripDeptStations _
Join s In db.tbl_Stations On tds.tds_Stn Equals s.stn_ID _
Where s.stn_County.Equals(county) _
Select New With {tds.tds_Trip}
Dim result = (From t In db.tbl_Trips _
Join ds2 In ds On t.trip_ID Equals ds2.tds_Trip _
Join toop In db.tbl_TourOperators On t.tourOp_ID Equals toop.tourOp_ID _
Where t.trip_StartDate >= startDate And t.trip_EndDate <= endDate And t.trip_StartDate >= Date.Today() _
Order By t.trip_StartDate _
Select New With {t.trip_ID, t.trip_Name, t.trip_StartDate, toop.tourOp_Name}).Distinct()