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.v20.1.dll

Declaration

public RecordsCount SelectRecordsCount(
    string alias
)
Public Function SelectRecordsCount(
    alias As String
) As RecordsCount

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