【问题标题】:Strange behaviour of CAML question - why?CAML 问题的奇怪行为 - 为什么?
【发布时间】:2010-02-18 09:39:44
【问题描述】:

我正在使用 caml 查询从共享点列表中检索数据。 问题是查询在不应该返回一条记录时,只有当我在自己的代码中使用此查询时才会发生这种情况。 当我使用相同的查询时,在 U2U Caml Query Builder 的同一个列表中它可以正常工作。

我的查询是这样的:

<Query><Where><Eq><FieldRef Name="Account_x0020_Verification_x0020" /><Value Type="Text">211edd1d11844d6c9f21d7930683caba</Value></Eq></Where></Query>

我用来启动它的 vb.net 代码是这样的:

 Dim oUserAccStatusList As SPList = oElevatedSPWeb.Lists(sListName)
                Dim oSPQuery As New SPQuery
                oSPQuery.Query = "<Query><Where><Eq><FieldRef Name='Account_x0020_Verification_x0020' /><Value Type='Text'>" + _sUserID + "</Value></Eq></Where></Query>"
                Dim oItems As SPListItemCollection = oUserAccStatusList.GetItems(oSPQuery)
                If oItems.Count <= 0 Then

Items.Count 为 1,其中有一条用户 ID 与我要求的不同的记录。有谁知道发生了什么,为什么会这样?

【问题讨论】:

    标签: sharepoint wss-3.0 caml


    【解决方案1】:

    从 oSPQuery.Query 属性中删除查询节点。

    oSPQuery.Query = "<Where><Eq><FieldRef Name='Account_x0020_Verification_x0020' /><Value Type='Text'>" + _sUserID + "</Value></Eq></Where>"
    

    【讨论】:

    • 这是一个非常讨厌的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-03-05
    • 2021-06-01
    • 2015-09-24
    • 1970-01-01
    • 2010-11-22
    • 1970-01-01
    • 2021-11-01
    相关资源
    最近更新 更多