csharp SPQuery演示
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp SPQuery演示相关的知识,希望对你有一定的参考价值。
string joins = "<Join Type='LEFT' ListAlias='Systems'><Eq><FieldRef Name='System' RefType='Id' /><FieldRef List='Systems' Name='ID' /></Eq></Join>";
string projectedFields = "<Field Name='AppName' Type='Lookup' List='Systems' ShowField='AppName' /><Field Name='ShortName' Type='Lookup' List='Systems' ShowField='ShortName' />";
string viewfields = "<FieldRef name='ReferenceName' /><FieldRef name='ReferenceLink' /><FieldRef Name='AppName' /><FieldRef Name='ShortName' />";
string query = string.Format("<Where><Eq><FieldRef Name='ShortName' /> <Value Type='Text'>{0}</Value></Eq></Where>", Application);
var spQuery = new SPQuery();
spQuery.Joins = joins;
spQuery.Query = query;
spQuery.ViewFields = viewfields;
spQuery.ProjectedFields = projectedFields;
var items = sourceList.GetItems(spQuery);
SPWeb web = new SPSite("http://nick").OpenWeb("test"); //Open website
web.AllowUnsafeUpdates = true;
SPList list = web.Lists["ListName"];
SPQuery query = new SPQuery();
query.Query = "<Where>"+
"<And><And>"+
"<Eq><FieldRef Name=\"Filed_1\"/><Value Type=\"Text\">Test</Value></Eq>" +
"<Eq><FieldRef Name=\"Filed_2\"/><Value Type=\"Text\">" + (string)OneValue + "</Value></Eq>" +
"</And>"+
"<Eq><FieldRef Name=\"Filed_3\"/><Value Type=\"Text\">" + (string)TwoValue + "</Value></Eq>" +
"</And>"+
"</Where>";
query.RowLimit = 10;
//查询
SPListItemCollection items = list.GetItems(query);
以上是关于csharp SPQuery演示的主要内容,如果未能解决你的问题,请参考以下文章
[备查]使用 SPQuery 查询 "Person or Group" 字段
SPQuery 的Where 子句的用法
csharp AutoResetEvent演示
csharp RestSharp演示
csharp 谓词演示
csharp AutoMapper 6.0演示