Skip to main content

TableQuery.FilterString Property

Gets or sets the criteria used to filter data returned by the current TableQuery.

Namespace: DevExpress.DataAccess.Sql

Assembly: DevExpress.DataAccess.v24.2.dll

Declaration

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

Property Value

Type Default Description
String null

A String value that specifies the criteria used to filter data returned by the current TableQuery.

Remarks

The FilterString property allows you to filter the result set returned by TableQuery by specifying the required filter criteria. Note that if you want to filter a TableQuery by specified column values, you should 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.

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

To pass the existing query parameter (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";

To learn more about building filter criteria, see Simplified Criteria Syntax.

See Also