Skip to main content
A newer version of this page is available. .

SelectQueryFluentBuilder.Build(String) Method

Ends the chain of methods specified for a SelectQueryFluentBuilder.

Namespace: DevExpress.DataAccess.Sql

Assembly: DevExpress.DataAccess.v20.2.dll

NuGet Packages: DevExpress.DataAccess, DevExpress.WindowsDesktop.DataAccess

Declaration

public SelectQuery Build(
    string queryName
)

Parameters

Name Type Description
queryName String

A String value, specifying the query name.

Returns

Type Description
SelectQuery

A SelectQuery object.

Remarks

The chain of SelectQueryFluentBuilder methods must end with calling the Build method accepting the query name as a parameter.

In the following example, a query selects and orders records from a single data table.

using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DataAccess.Sql;
// ... 

private SqlDataSource BindToData() {
    // Create a data source with the required connection parameters. 
    Access97ConnectionParameters connectionParameters =
    new Access97ConnectionParameters("../../Data/nwind.mdb", "", "");
    SqlDataSource ds = new SqlDataSource(connectionParameters);

    // Return a list of categories sorted by the number of products in each category. 
    // The chain ends with calling the Build method accepting the query name as a parameter.
    SelectQuery query = SelectQueryFluentBuilder
        .AddTable("Products")
        .SelectColumn("CategoryID")
        .GroupBy("CategoryID")
        .SortBy("ProductID", AggregationType.Count, System.ComponentModel.ListSortDirection.Descending)
        .Filter("[CategoryID] != 8")
        .Build("MyQuery");

    // Add the query to the collection and return the data source. 
    ds.Queries.Add(query);
    return ds;
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the Build(String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also