Отображение результатов запроса CAML? - PullRequest
1 голос
/ 17 ноября 2011

Я пытаюсь выполнить запрос CAML на основе условного оператора if.Таким образом, если переменная в этом случае «xapthresult» равна «BT ADSL», запрос будет выполнен.Ниже приведен фрагмент кода:

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


}

Я хотел бы знать, как отображать результаты запроса в веб-части!

Любая помощь будет принята с благодарностью,

Спасибо

1 Ответ

1 голос
/ 17 ноября 2011

вы можете использовать SPGridView .

...