Share via


QueryByAttribute.TopCount Property

 

Applies To: Dynamics CRM 2015

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; }
public:
[DataMemberAttribute(Order = 50)]
property Nullable<int> TopCount {
    Nullable<int> get();
    void set(Nullable<int> value);
}
[<DataMemberAttribute(Order = 50)>]
member TopCount : Nullable<int> with 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

© 2016 Microsoft. All rights reserved. Copyright