Skip to main content

SelectQuery.SelectRecordsCount(String) Method

Extends a query’s result set with a column that specifies the row count in the requested table or, if there are groups in the table, - the rows count in each group.

Namespace: DevExpress.DataAccess.Sql

Assembly: DevExpress.DataAccess.v24.1.dll

NuGet Packages: DevExpress.DataAccess, DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap

Declaration

public RecordsCount SelectRecordsCount(
    string alias
)

Parameters

Name Type Description
alias String

A String value specifying an alias to be used for the result set’s column.

Returns

Type Description
RecordsCount

A RecordsCount object that allows you to get the name of the result set’s column to then access this column.

Remarks

The following code demonstrates how to use the SelectRecordsCount method to select record count in a table:

using DevExpress.DataAccess.Sql;
// ...  
    var sqlDataSource = new SqlDataSource();
    var selectQuery = new SelectQuery("Categories_Count");
    selectQuery.AddTable("Categories");
    selectQuery.SelectRecordsCount("records_count");
    sqlDataSource.Queries.Add(selectQuery);
    sqlDataSource.Fill();
See Also