首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >是否显示CAML查询结果?

是否显示CAML查询结果?
EN

Stack Overflow用户
提问于 2011-11-17 17:57:20
回答 1查看 902关注 0票数 1

我正在尝试基于条件if语句执行CAML查询。因此,如果本例中的变量"xapthresult“等于"BT ADSL”,则将执行查询。下面是代码的一段:

代码语言:javascript
复制
//Executing the correct query based on a if condition for BT ADSL
if(xpathresult == "BT ADSL")
{

//Creating the CAML query to perfomr the query on the list to find the required values
SPQuery query = new SPQuery();


//try to find items in this list that matches the result of the XPATH query performed
//earlier
//in this case "BT/Standard"
string camlquery = @"<Query>
<Where>
<Eq>
<FieldRef Name='Vendor_x0020_Product_x0020_Name'/>
<Value Type='Text'>" + xpathresultBTADSL + @"</Value>
</Eq>
</Where>  
</Query>";

query.Query = camlquery;
query.ViewFields = "<FieldRef Name='Fabric_x0020_Name'/>
<FieldRefName='Defined_x0020_For/><FieldRef name='MPLS'/>"; 
//selecting only the required fields from the CAML query

SPListItemCollection listItemCollection = list.GetItems(query);


}

我想知道如何在一个how部件中显示查询结果!

任何帮助都将不胜感激,

谢谢

EN

回答 1

Stack Overflow用户

发布于 2011-11-17 18:20:33

您可以使用SPGridView控件。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8165186

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档