Gets or sets the expression used to filter which rows are viewed in the DataView.
[Visual Basic] Public Overridable Property RowFilter As String [C#] public virtual string RowFilter {get; set;} [C++] public: __property virtual String* get_RowFilter(); public: __property virtual void set_RowFilter(String*); [JScript] public function get RowFilter() : String; public function set RowFilter(String);
A string that specifies how rows are to be filtered. For more details, see the Remarks below.
To form a RowFilter value, specify the name of a column followed by an operator and a value to filter on. The value must be in quotes. For example:
"LastName = 'Smith'"
See the DataColumn class's Expression property for more information.
To return only those columns with null values, use the following expression:
"Isnull(Col1,'Null Column') = 'Null Column'"
[Visual Basic, C#] The following example creates a DataView and sets its RowFilter property.
[Visual Basic] Private Sub MakeDataView() Dim dv As DataView dv = New DataView With dv .Table = DataSet1.Tables("Suppliers") .AllowDelete = True .AllowEdit = True .AllowNew = True .RowFilter = "City = 'Berlin'" .RowStateFilter = DataViewRowState.ModifiedCurrent .Sort = "CompanyName DESC" End With ' Simple bind to a TextBox control Text1.DataBindings.Add("Text", dv, "CompanyName") End Sub [C#] 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"); }
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework - Windows CE .NET
DataView Class | DataView Members | System.Data Namespace | Expression | Sort