'Declaration Public Property Filter As System.String
public System.string Filter {get; set;}
'Declaration Public Property Filter As System.String
public System.string Filter {get; set;}
Use the Filter property to restrict the records that you want to include in a data source without modifying the RecordSource property.
Using a filter is similar to specifying a WHERE clause in the SQL statement assigned to the RecordSource property. Both techniques will filter the data according to the condition specified. The difference is that the Filter property is applied to a table that has already been loaded in memory, while the WHERE statement causes only the filtered records to be loaded from the database into memory.
When creating reports that include only small subsets large tables, the WHERE statement is a better option, because it doesn't require the entire table to be loaded into memory. On the other hand, if the table has already been loaded in memory, the Filter property is a better option, since it does not require any additional data to be loaded.
The syntax for the filter expression is determined by the FilterSyntax property.
Filter
property and using a WHERE clause in a SQL statement:
if (useFilterProperty) { // load all records, filter in memory _c1r.DataSource.RecordSource = "SELECT * from Employees"; _c1r.DataSource.Filter = "HireDate >= '1/1/1993' AND Country = 'UK'"; } else { // load selected records only _c1r.DataSource.RecordSource = "SELECT * from Employees " + "WHERE HireDate >= #1/1/1993# AND Country = 'UK'";