SelectQueryFluentBuilder.Filter(String) Method

Specifies the criteria used to filter data returned by the current query.

Namespace: DevExpress.DataAccess.Sql

Assembly: DevExpress.DataAccess.v20.2.dll

Declaration

public SelectQueryFluentBuilder Filter(
    string filterString
)
Public Function Filter(
    filterString As String
) As SelectQueryFluentBuilder

Parameters

Name Type Description
filterString String

A String value, specifying the filter criteria.

Returns

Type Description
SelectQueryFluentBuilder

A SelectQueryFluentBuilder object.

Remarks

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;
}
See Also