SelectQueryFluentBuilder.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.2.dll

Declaration

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

Parameters

Name Type Description
alias String

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

Returns

Type Description
SelectQueryFluentBuilder

A SelectQueryFluentBuilder object that can be used to further configure the SELECT statement.

Remarks

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

using DevExpress.DataAccess.Sql;
// ...  
private SqlDataSource BindToData() {
    var sqlDataSource = new SqlDataSource();
    var query = SelectQueryFluentBuilder
        .AddTable("Categories");
        .SelectRecordsCount("records_count")
        .Build("Categories_Count");

    sqlDataSource .Queries.Add(query);
    sqlDataSource .Fill();
}
See Also