0
votes

I have a sharepoint list with the following fields:

Product Name Product Description Price Product Type


Product Type can be either a CD or DVD

I would like to be able to obtain all data/records on the list based on a CAML query for Product Type. Here is my CAML query:

string prodType1= "CD"; string prodType2= "DVD";

string camlquery = 
@"<Where>
<Eq>
<FieldRef Name='Products_x0020_Type'/>
<Value Type='Text'>" + prodType1 + @"</Value>
</Eq>
</Where>";

I want to be able to bring back all data/records for product type CD. How can I acieve this with CAML, if possible. If not possible what other method would be recommended for this.

I have been scratching my head with this for a over a week now, any help will be greatly appreciated.

Many Thanks in Advance

1
can you verify that your CAML query in your question matches what you are using. Currently that's not a valid query with the dangling (unclosed) FieldsRef tag. - Ken Henderson
my mistake I have ammended what the CAML query to what it should be - Dev P

1 Answers

3
votes

i'd suggest the U2B CamlQuery Builder.. it's the easiest way to build your queries and saves you a lot of trouble and time...

when you finished building just go to the editor tab and copy the query (without the <query> tag);...