sharepoint SPQuery 大数据量怎么分页查询??
------解决方案--------------------
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spquery.rowlimit.aspx
------解决方案--------------------
using (SPWeb oWebsiteRoot = SPContext.Current.Site.RootWeb)
{
SPList oList = oWebsiteRoot.Lists["Announcements"];
SPQuery oQuery = new SPQuery();
oQuery.RowLimit = 10;
oQuery.Query = "<OrderBy Override=\"TRUE\">" +
"<FieldRef Name=\"FileLeafRef\" /></OrderBy>";
int intIndex = 1;
do
{
Response.Write("<BR>Page: " + intIndex + "<BR>");
SPListItemCollection collListItems = oList.GetItems(oQuery);
foreach(SPListItem oListItem in collListItems)
{
Response.Write(SPEncode.HtmlEncode(oListItem["Title"]) +
"<BR>");
}
oQuery.ListItemCollectionPosition =
collListItems.ListItemCollectionPosition;
intIndex++;
} while(oQuery.ListItemCollectionPosition != null);
}
------解决方案--------------------
是用spgridview做的 分页时把页面传给 spquery.query。
比如1页10个,第二页 11-20.
第一页 就前10
------解决方案--------------------
参考这个吧 介绍 你怎么用。
SPSiteDataQuery q = new SPSiteDataQuery();
string sQuery = "<Where>" +
"<Gt>" +
"<FieldRef Name='ID' />" +
"<Value Type='Number'>0</Value>" +
"</Gt>" +
"</Where>";
q.Lists = "<Lists BaseType='1'/>";
q.Query = sQuery;
q.Webs = "<Webs Scope='SiteCollection' />";
q.ViewFields = "<FieldRef Name='Title' />" +
"<FieldRef Name='ID' />";
q.RowLimit = 10;
http://blog.csdn.net/jason_dct/article/details/7609771
------解决方案--------------------
mark
------解决方案--------------------
有用 以后用的着。。
------解决方案--------------------
参考: http://extreme-sharepoint.com/2012/06/22/spquery-pagination/
------解决方案--------------------