Danh mục

Performing Advanced Filtering

Số trang: 1      Loại file: pdf      Dung lượng: 11.42 KB      Lượt xem: 2      Lượt tải: 0    
Hoai.2512

Xem trước 1 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

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.
Nội dung trích xuất từ tài liệu:
Performing Advanced FilteringPerforming Advanced FilteringThe RowFilter property of a DataView is similar to a WHERE clause in a SELECTstatement. You can therefore use very powerful filter expressions in your DataView. Forexample, you can use AND, OR, NOT, IN, LIKE, comparison operators, arithmeticoperators, 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.Heres a simple example that uses the LIKE operator and the percent (%) wildcardcharacter 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 stringliterals. When this code replaces the existing code in the UsingDataView.cs programshown earlier in Listing 13.1, the output is as follows:FRANKFrankenversandGermanyFRANRFrance restaurationFranceFRANSFranchi S.p.A.ItalyNote Ive 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.

Tài liệu được xem nhiều: