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

SelectQuery.FilterString Property

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

Namespace: DevExpress.DataAccess.Sql

Assembly: DevExpress.DataAccess.v19.2.dll

Declaration

[DefaultValue(null)]
[LocalizableCategory(DataAccessStringId.QueryPropertyGridTableSelectionCategoryName)]
public string FilterString { get; set; }

Property Value

Type Default Description
String *null*

A String value, specifying the filter criteria.

Remarks

The FilterString property allows you to filter the result set returned by SelectQuery by specifying the required filter criteria. To filter a SelectQuery by specified column values, precede a column name with a corresponding table name. For instance, you can filter the SalesPerson table by the Beverages category in the following way.

SelectQuery query = new SelectQuery("Query 1");
query.AddTable("SalesPerson").SelectColumns("CategoryName", "Extended Price");
query.FilterString = "[SalesPerson].[CategoryName] = 'Beverages'";

To pass a QueryParameter (which can be accessed using the SqlQuery.Parameters property) to the filter string, precede the parameter name with the ? sign.

//...
QueryParameter queryParam1 = new QueryParameter("Parameter1", typeof(string), "Beverages");
query.Parameters.Add(queryParam1);
query.FilterString = "[SalesPerson].[CategoryName] = ?Parameter1";

Note

If a table or column name includes dots, enclose the table/column name in square brackets.

For example, if you have a table with the “table.name” name and a column with the “column.name” name, refer to the column in the following manner: [[table.name\].[column.name\]]. If you have only the column name with a dot, refer to it as follows: [tablename.[column.name\]]. As you can see, you should use \ to avoid closing the expression beforehand.

To learn more about building filter criteria, see Creating Criteria.

The following code snippets (auto-collected from DevExpress Examples) contain references to the FilterString property.

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