[問題] 關於Lambda語法
小弟想請教個問題
我用mssql當作資料庫,透過EF去取資料,想要作排序的動作 (依日期)
code如下
var t2 = (from t in _dbContext.prediction_table
where t.final_score != null
&& t.final_score != "cancel"
&& t.final_score != "postponed"
orderby t.gamedate_judge descending
select t.gamedate_judge).Distinct();
(gamedate_judgu型態是DateTime),理論上這樣應該是取出排序過的值
可我將其轉存到DateTime[] dt = t2.ToArray();
卻發現內容不是按順序排,出現如下結果
2016/6/6 上午12:00:00
2016/7/6 上午12:00:00
2016/7/22 上午12:00:00
2016/5/31 上午12:00:00
2016/7/30 上午12:00:00
是我弄錯語法嗎??
可否告知方向,謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 122.121.218.23
※ 文章網址: https://www.ptt.cc/bbs/C_Sharp/M.1471939454.A.0CA.html
→
08/23 16:08, , 1F
08/23 16:08, 1F
→
08/23 19:04, , 2F
08/23 19:04, 2F
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章