Archive

Posts Tagged ‘CAML’

CAML Query WHERE Clause not working and returning all records

January 12, 2011 5 comments

One thing I found about CAML query in SharePoint Development is when you put WHERE Clause in query it still returns all records.

For example:


SPQuery query = new SPQuery();
query.Query =
“<Query><Where></Where></Query>”

Here is the Fix:

Remove the “<Query> Tag and rewrite it

SPQuery query = new SPQuery();
query.Query =
“<Where></Where>”

 

This should fix it .

 


 

Advertisements
Categories: SharePoint Tags: ,