我如何在Linq to SQL中做一个案例(请访问vb.net).
在SQL中它将是这样的:
SELECT CASE WHEN condition THEN trueresult [...n] [ELSE elseresult] END
我如何在Linq to SQL中执行此操作?
var data = from d in db.tb select new { CaseResult = If (d.Col1 = “Case1”, "Case 1 Rised", If (d.Col1 = “Case2”, "Case 2 Rised", "Unknown Case")) };