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; }
<DefaultValue(Nothing)>
<LocalizableCategory(DataAccessStringId.QueryPropertyGridTableSelectionCategoryName)>
Public Property FilterString As String

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.

See Also