以下是我的LINQ查詢:LINQ子查詢問題
var varResourceStatusReportDataBase =
(
from content in listContent
join workflowInstance in listWorkflkowInstance
on content.Field<string>("ows_ID").Trim()
equals workflowInstance.Field<string>("ows_Content ID").Split(';')[0].Trim()
join WorkflowInstanceStep in listWorkflowInstanceStep
on workflowInstance.Field<string>("ows_ID")
equals WorkflowInstanceStep.Field<string>("ows_Workflow Instance ID").Split(';')[0]
select new
{
ContentName = content.Field<string>("ows_Name"),
WorkflowInstanceId = workflowInstance.Field<string>("ows_ID"),
WIName = workflowInstance.Field<string>("ows_Title"),
WIPlannedStartDate = workflowInstance.Field<string>("ows_Planned Start Date") ?? "",
WIPlannedEndDate = workflowInstance.Field<string>("ows_Planned End Date") ?? "",
WIActualStartDate = workflowInstance.Field<string>("ows_Actual Start Date") ?? "",
WIActualEndDate = workflowInstance.Field<string>("ows_Actual End Date") ?? "",
WIApprovalDate = workflowInstance.Field<string>("ows_Approval Date") ?? "",
WITaskStatus = workflowInstance.Field<string>("ows_Status").ToUpper() ?? "",
WIMetadataStatus = workflowInstance.Field<string>("ows_Metadata Status") ?? "",
WIApprover = workflowInstance.Field<string>("ows_Approver").Replace("#", "").Split(';')[1].ToUpper() ?? "",
WISResponsible = WorkflowInstanceStep.Field<string>("ows_Responsible").Replace("#", "").Split(';')[1].ToUpper() ?? "",
WISDesiredEndDate=
(
from WorkflowInstanceStep1 in listWorkflowInstanceStep
where (WorkflowInstanceStep1.Field<string>("ows_Status") =="IN PROGRESS" ||
WorkflowInstanceStep1.Field<string>("ows_Status") =="ASSIGNED") &&
workflowInstance.Field<string>("ows_ID") == WorkflowInstanceStep1.Field<string>("ows_Workflow Instance ID").Split(';')[0]
select new {abc = WorkflowInstanceStep1.Field<string>("ows_Desired End Date")}).Take(1)
}).Distinct();
我在上面查詢子查詢計算WISDesiredEndDate
,但是當我執行這個查詢,我得到WISDesiredEndDate
列沒有實際價值System.Linq.Enumerable+TakeIterator>d__3a'1[<>f__AnonymousType1'1[System.String]]
值我想。 請給出同樣的建議。 謝謝。
嗨,謝謝。它爲我工作,但現在「WISDesiredEndDate」列給價值{abc = 2014-02-28 00:00:00}但我只想要日期。 –
我從我身邊做過。謝謝。 –
@PrashantKhadatkar更新了答案 –