CAML query on sharepoint list

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


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);...

链接地址: http://www.djcxy.com/p/64136.html

上一篇: CAML查询比较DateTime和Eq

下一篇: CAML查询在SharePoint列表中