SPC050233: Define RowLimit for SPQuery

Define RowLimit for SPQuery to limit the number of items returned in the query.

TypeName: UseRowLimitInQueries
CheckId: SPC050233
Severity: CriticalWarning
Type: AssemblyFileReference

The RowLimit property is used together with the ListItemCollectionPosition property to define paging in a query. See sample below:

SPWeb web = SPControl.GetContextWeb(Context)
SPList oList = web.Lists["Announcements"];
SPQuery oQuery = new SPQuery();
oQuery.RowLimit = 10;
oQuery.Query = "<OrderBy Override=\"TRUE\"><FieldRef Name=\"FileLeafRef\" /></OrderBy>";


comments powered by Disqus