Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用DB2XML列的linq查询_C#_Linq_Entity Framework_Collections_Db2 - Fatal编程技术网

C# 使用DB2XML列的linq查询

C# 使用DB2XML列的linq查询,c#,linq,entity-framework,collections,db2,C#,Linq,Entity Framework,Collections,Db2,在我的db2数据库中,我有以下列 IdInstanceTag int, APPROVED_TIME timestamp, ModifiedTime date, DATE_TO date, DEFINITION XML, ID int, CreatedBy varchar(100), ModifiedBy varchar(100) 在上面包含数据的列中,xml列数据如下所示 <Template xmlns:xsi="http://www.w3.org/2001/XMLSchema-inst

在我的db2数据库中,我有以下列

IdInstanceTag int,
APPROVED_TIME timestamp,
ModifiedTime date,
DATE_TO date,
DEFINITION XML,
ID int,
CreatedBy varchar(100),
ModifiedBy varchar(100)
在上面包含数据的列中,xml列数据如下所示

<Template xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:type="GlobalTemplateDefinition" Name="TrinadhDemo" AgentLevel="Location" APSRatioPercent="50" xmlns="urn:wu-compliance-iwatch:gfo">
<Sections>
<Section ID="1" Name="S1" WeightOrPoints="0">
<Questions>
<CoreQuestion xsi:type="FreeTextQuestion" ID="1" Text="Q1 Free Text" IsOptional="false">
<MaximumQAPoints xsi:nil="true"/>
</CoreQuestion>
<CoreQuestion xsi:type="CalendarQuestion" ID="2" Text="Q2 Calendar control" IsOptional="false">
<MaximumQAPoints xsi:nil="true"/>
</CoreQuestion>
<CoreQuestion xsi:type="FixedListQuestion" ID="3" Text="Q3 Free List" IsOptional="false" MultiSelectAvailable="false">
<MaximumQAPoints xsi:nil="true"/>
<Rule ParentQuestionID="2" EnableValue="IN" RuleSpecification="Equal"/>
<Options><string>IN</string><string>US</string></Options>
</CoreQuestion>
<CoreQuestion xsi:type="YesNoQuestion" ID="4" Text="erfcewrf" IsOptional="false" Score="0" IsNAAvailable="false" SuppressFindingTextBox="false">
<MaximumQAPoints xsi:nil="true"/>
<ScoreInSectionID xsi:nil="true"/>
<FindingDescription>wdqcfvewr</FindingDescription>
<Actions><string>Action 1</string><string>Action 2</string><string>Action 3</string></Actions>
</CoreQuestion>
</Questions>
</Section>
</Sections>
</Template>

我正在从表中检索上述所有列,但无法读取xml列属性值“AgentLevel”,请帮我解决这个问题。

我认为您的查询中根本没有引用
DEFINITION
AgentLevel
。事实上,我不知道如何使用该查询检索代理级别属性值…
IdInstanceTag
-我喜欢这个名称,它是一个ID?、一个实例?、一个标记吗?没人知道。
ctx => from oInterviewTemplate in ctx.InterviewTemplate
                        join oCreatedUser in ctx.Users on oInterviewTemplate.CreatedUserId equals oCreatedUser.UserId
                            into oCreatedUserJoin
                        from oCreatedUserResult in oCreatedUserJoin.DefaultIfEmpty()
                        join oModifedUser in ctx.Users on oInterviewTemplate.ModifiedByUserId equals oModifedUser.UserId
                            into oModifedUserJoin
                        from oModifedUserResult in oModifedUserJoin.DefaultIfEmpty()
                        where ((interviewTemplateTypeId==null && oInterviewTemplate.ParentId==null) 
                        || (interviewTemplateTypeId!=null && oInterviewTemplate.ParentId!=null))
                        orderby oInterviewTemplate.Id ascending
                        select new InterviewTemplateLookup
                        {
                            InterviewTypeID = oInterviewTemplate.Id,
                            Id = oInterviewTemplate.Id,
                            InterviewTypeDescription = oInterviewTemplate.Name,
                            Name = oInterviewTemplate.Name,
                            IsApproved = oInterviewTemplate.ApprovedTime == null ? "No" : "Yes",
                            CreatedBy = oCreatedUserResult.FirstName + " " + oCreatedUserResult.LastName,
                            ModifiedBy = oModifedUserResult.FirstName + " " + oModifedUserResult.LastName,
                            CreatedTime = oInterviewTemplate.CreatedTime,
                            Status = oInterviewTemplate.IsDeleted == 0 ? "Active" : "Inactive",
                            ModifiedTime = oInterviewTemplate.ModifiedTime,
                            IdInstanceTag=oInterviewTemplate.IdInstanceTag,
                        });