各位好:小弟遇到以下問題,請教各位該如何處理?var rs = from t1 in db.t1 join in t2 in db.t2 on t1.id = t2.id into _t2 from t2 in _t2.DefaultIfEmpty() select new { id = t1.id, BeginDate = t2.Begindate//Begindate為datetime型 };請問各位:如果Begindate為空該怎么寫?不會是BeginDate = t2.Begindate == null? **:**吧?
2 回答
函數(shù)式編程
TA貢獻1807條經(jīng)驗 獲得超9個贊
汗一個:
當(dāng)你的Begindate在數(shù)據(jù)庫定義為can null的時候
你生成的DataContext定義的Begindate 就是 datetime?的可空類型了。
看看Nullable<T>的定義自己好好看看吧。
自己試驗一下吧。
- 2 回答
- 0 關(guān)注
- 1072 瀏覽
添加回答
舉報
0/150
提交
取消
