1
votes

I wrote a dynamic CAML query to pick field columns and values from a dropdown and text box basing upon the conditions I put. The CAML query below:

"<query>
    <Query>
       <Where>
          <And>
             <Eq>
                <FieldRef Name='" + QryCol + "' />
                <Value Type='Text'>" + QryVal + "</Value>
             </Eq>
             <Neq>
                 <FieldRef Name='" + ColNam + "' />
                 <Value Type='Text'>" + ColVal + "</Value>
             </Neq>
          </And>
       </Where>
    </Query>
</query>"

The error I get is

The data types ntext and nvarchar are incompatible in the not equal to operator

Surprising factor is that the code is working well if ColNam and ColVal variables are picked from a dropdown(HTML) element But throwing the above error if ColNam and ColVal variables are picked from a textbox(both asp or HTML type)

I tried using Value Type='Note' for ColVal and <![CDATA[ColVal]]> as well which did not work. I wrote this CAML Query to embed in a SOAP envelope. I am coding in SharePoint Designer 2007(javascript).

1
You might have better luck on sharepoint.stackexchange.comharsimranb

1 Answers

0
votes

You can't use <Neq> operator for muliline field. Myabe you can just filter out on javascript side unwanted results.