Performing Advanced Filtering
Số trang: 1
Loại file: pdf
Dung lượng: 11.42 KB
Lượt xem: 7
Lượt tải: 0
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.
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ìm kiếm theo từ khóa liên quan:
kĩ thuật lập trình công nghệ thông tin lập trình ngôn ngữ lập trình C Shark C# sybex - c.sharp database programming Performing Advanced FilteringTài liệu có liên quan:
-
52 trang 468 1 0
-
Top 10 mẹo 'đơn giản nhưng hữu ích' trong nhiếp ảnh
11 trang 367 0 0 -
96 trang 334 0 0
-
74 trang 329 0 0
-
Đồ án tốt nghiệp: Xây dựng ứng dụng di động android quản lý khách hàng cắt tóc
81 trang 321 0 0 -
Tài liệu dạy học môn Tin học trong chương trình đào tạo trình độ cao đẳng
348 trang 321 1 0 -
Giáo trình Lập trình hướng đối tượng: Phần 2
154 trang 316 0 0 -
Kỹ thuật lập trình trên Visual Basic 2005
148 trang 310 0 0 -
Báo cáo thực tập thực tế: Nghiên cứu và xây dựng website bằng Wordpress
24 trang 304 0 0 -
Tài liệu hướng dẫn sử dụng thư điện tử tài nguyên và môi trường
72 trang 303 0 0