DataView.RowFilter use

private void MakeDataView()

{
   DataView dv = new DataView();
   dv.Table = DataSet1.Tables["Suppliers"];
   dv.AllowDelete = true;
   dv.AllowEdit = true;
   dv.AllowNew = true;
   dv.RowFilter = "City = 'Berlin'";
   dv.RowStateFilter = DataViewRowState.ModifiedCurrent;
   dv.Sort = "CompanyName DESC";
 
   // Simple bind to a TextBox control
   Text1.DataBindings.Add("Text", dv, "CompanyName");
}
User-defined value may be used in the expression is compared with the column values. String value should be placed in single quotes. Date values ​​should be placed within a pound sign (#). For numeric, decimal and allows scientific notation. E.g:  
"FirstName = 'John'"
"Price <= 50.00"
"Birthdate < #1/31/82#"
For enumeration value column contains the value of integer data type cast. E.g:
"EnumColumn = 5"
Operators
When used in series allows Boolean AND, OR and NOT operators. Parentheses may be used in combination clauses and forced priority. AND operator precedence over other operators. E.g:
(LastName = 'Smith' OR LastName = 'Jones') AND FirstName = 'John'
When you create a comparison expression, allowing the use of the following operators:
<
>
<=
>=
<>
=
IN
LIKE
In the expression further supports the following arithmetic operators:
+ (Addition) - (subtraction) * (multiplication) / (division)% (modulus)
String operators
To connect strings, use the + character. Case-insensitive string comparisons are determined by the value of the property CaseSensitive DataSet class. However, this value can override DataTable CaseSensitive property class.
Wildcards
In comparison LIKE,% *, and both can be used interchangeably as a wildcard. If the string contains LIKE clause * or%, then these characters applications brackets ([]) be escaped. If there are clauses in parentheses, then the bracket characters use brackets be escaped (for example, [[] or []]). Mode the beginning and end, or the end of the model, or at the beginning of the pattern allows the use of wildcards. E.g:
"ItemName LIKE '*product*'"
"ItemName LIKE '*product'"
"ItemName LIKE 'product*'"
Wildcards are not allowed in the middle of the string. For example, is not allowed 'te * xt'.
Parent / child relationship references
By adding Parent in front of the column name, you can reference the parent table in the expression. For example, Parent.Price column named Price references the parent table.
In front of the column name by adding a Child, the sub-table can be referenced in an expression columns. However, because child relationships can return multiple rows, you must include a reference sub-functions listed in the polymerization. For example, Sum (Child.Price) returns the sum of the child table named Price column.
If a table multiple sub-table, the syntax is: Child (RelationName). For example, if a table has two sub-tables, their names were Customers and Orders, the DataRelation object is named Customers2Orders, reference will be:
Avg(Child(Customers2Orders).Quantity)
polymerization
Polymeric supports the following types:
Sum (sum) Avg. (Average) Min (minimum) Max (maximum value) the Count (Count)
StDev (statistical standard deviation) Var (statistical variance).
RowFilter the query syntax and the role of the SQL statement SELECT statement is very similar,
The polymerization is usually performed along relationship. By using one of the above functions, "parent / child relationships referenced" listed above detailed sublist, to create the aggregate expressions. E.g:
Avg(Child.Price)
Avg(Child(Orders2Details).Price)
The polymerization can also be performed on a single table. For example, to create a column named "Price" in the digital summary to use: Sum (Price)

Guess you like

Origin www.cnblogs.com/ljs-13/p/12126442.html
use
use