Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

CAML query where cluase not working .Returing all record not according to where clause on lookup field

$
0
0

Hi,

I copied this query from u2u query builder ,its working fine there but as I copy this query to my webpart

its returning all records from list not particular record according to where clause "parentID" (see in below query)

I want to utilize this query to pass id on where clause which is lookup field and retrieve record according to ID not all

How can I done this

  SPQuery query = new SPQuery();

                                    string strquery = "<Query>"+
                                                   "< Where >" +
                                                   "< And >"
                                                    + "  < Eq > "
                                                    + "    < FieldRef Name = 'PlantFk_x003a_ID'  LookupId='TRUE' /> "
                                                    + "      < Value Type = 'number' > " + ParentID + "</ Value >"
                                                    + "    </ Eq >  "
                                                    + "   < Eq >  "
                                                    + "      < FieldRef Name = 'Flag' /> "
                                                    + "       < Value Type = 'Number' > 1 </ Value > "
                                                    + "     </ Eq > "
                                                    + "  </ And > "
                                                    + " </ Where > "
                                                    + " </Query>";
                                    query.Query = strquery;

Thanks Need Help Plz


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>