QueryByAttribute.TopCount Property

Applies To: Microsoft Dynamics CRM 2013, Microsoft Dynamics CRM Online

Gets or sets the number of rows to be returned.

Namespace: Microsoft.Xrm.Sdk.Query
Assembly: Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)

Syntax

'Declaration
<DataMemberAttribute(Order:=50)> _
Public Property TopCount As Nullable(Of Integer)
[DataMemberAttribute(Order=50)] 
public Nullable<int> TopCount { get; set; }

Property Value

Type: Int32
The number of rows to be returned.

Example

public void TestQueryByAttributeWithTopCount()
{
         QueryByAttribute query = new QueryByAttribute();
         query.EntityName = "Account";
         query.ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet(new string[] { "name" });
         query.AddAttributeValue("address1_city", "seattle");
         query.TopCount = 3;
}

Remarks

When specified, this limits the number rows returned in a query result set to the specified number of rows.

A query can contain either PageInfo or TopCount property values. If both are specified, an error will be thrown.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows Server 2008, Windows Server 2012, Windows 7 (All Versions), Windows 8 (All Versions)

Target Platforms

Windows Server 2008, ,Windows Server 2012, ,Windows 7 (All Versions),

Change History

See Also

Reference

QueryByAttribute Class
QueryByAttribute Members
Microsoft.Xrm.Sdk.Query Namespace

Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.