1
錯誤我使用LINQPad來運行下面的查詢:LINQ到SQL查詢與StartsWith
var pds = (from p in Projects
group p by p.FiscalYearVariables.FiscalYear into grouped
where grouped.Count() > 0
select new {
fiscalYear = grouped.Key,
projectDetails = grouped.SelectMany(a=>a.ProjectDetails),
Programs = (from pwbs in Programs.SelectMany(a =>a.ProgramWbsNumbers)
let ds = pwbs.WbsNumbers.DisplayString
where pwbs.Programs.IsActive
&& (from w in WbsNumbers
where w.DisplayString.StartsWith(ds)
select w).Any()
select pwbs.Programs)
});
pds.Dump();
而我得到的錯誤:
NotSupportedException: Only arguments that can be evaluated on the client are supported for the String.StartsWith method.
我不知道如何去關於糾正這個錯誤。我需要得到每個Program
,WbsNumber
開始WbsNumber
ProgramWbsNumbers
如果有幫助。
工作!謝謝。 –