Compartilhar via


RowLimit Property

The RowLimit property of the SPQuery class gets or sets a limit for the number of items returned in the query per page.

Property Value

An unsigned 32-bit integer that specifies the row limit.

Remarks

The RowLimit property is used together with the ListItemCollectionPosition properties of the SPListItemCollection and SPQuery classes and with the SPListItemCollectionPosition class to define paging in a query. Specifically, the SPListItemCollectionPosition object is used to iterate through all the items in a collection n items at a time where n is the value specified as a row limit.

The RowLimit property contains a value that corresponds to the value of the RowLimit element in Collaborative Application Markup Language (CAML).

Example

The following code example uses the ListItemCollectionPosition properties of the SPListItemCollection and SPQuery classes to return an SPListItemCollectionPosition object for storing where each page of data leaves off in the collection of items and displays the titles of items in groups of 10 rows apiece.

The next code example uses the RowLimit property to specify a limit of 50 items per page to return in the query.

Both examples require using directives (Imports in Visual Basic) for the Microsoft.SharePoint, Microsoft.SharePoint.Utilities, and Microsoft.SharePoint.WebControls namespaces.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security