1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu Performing Advanced Filtering pdf

1 138 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Performing Advanced Filtering
Định dạng
Số trang 1
Dung lượng 11,42 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Performing Advanced Filtering The RowFilter property of a DataView is similar to a WHERE clause in a SELECT statement.. You can therefore use very powerful filter expressions in your Dat

Trang 1

Performing Advanced Filtering

The RowFilter property of a DataView is similar to a WHERE clause in a SELECT statement You can therefore use very powerful filter expressions in your DataView For example, you can use AND, OR, NOT, IN, LIKE, comparison operators, arithmetic operators, wildcard characters (* and %), and aggregate functions

Note For full details on how to use such filter expressions in your DataView objects, refer

to the DataColumn Expression property in the NET online documentation

Here's a simple example that uses the LIKE operator and the percent (%) wildcard

character to filter rows with a CustomerName that starts with Fr:

string filterExpression = "CompanyName LIKE 'Fr%'";

customersDV.RowFilter = filterExpression;

Notice that the string Fr% is placed in single quotes-which you must do for all string literals When this code replaces the existing code in the UsingDataView.cs program shown earlier in Listing 13.1, the output is as follows:

FRANK

Frankenversand

Germany

FRANR

France restauration

France

FRANS

Franchi S.p.A

Italy

Note I've made this change in the UsingDataView2.cs program (the listing is omitted

from this book for brevity) Feel free to examine and run this program

Ngày đăng: 21/01/2014, 07:20

w