Del via


QueryByAttribute.TopCount Property

 

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, 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

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

Property Value

Type: System.Nullable<Int32>

Type: Int32
The number of rows to be returned.

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.

Examples

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;
}

See Also

QueryByAttribute Class
Microsoft.Xrm.Sdk.Query Namespace

Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright