TAILIEUCHUNG - Finding DataRowView Objects in a DataView

Finding DataRowView Objects in a DataView You can find the index of a DataRowView in a DataView using the Find() method of a DataView | Finding DataRowView Objects in a DataView You can find the index of a DataRowView in a DataView using the Find method of a DataView. You can also get an array of DataRowView objects using the FindRows method of a DataView. You ll learn how to use the Find and FindRows methods in this section. Finding the Index of a DataRowView Using the Find Method The Find method returns the index of the DataRowView with the specified primary key in your DataView. The int returned by this method is the index of the DataRowView if found otherwise -1 is returned. To find the correct index you must first set the Sort property of your DataView to sort on the primary key. For example if you want to find a DataRowView based on the CustomerlD you must set the Sort property of your DataView to CustomerlD CustomerlD ASC or CustomerlD DESC string sortExpression CustomerlD sortExpression Assume that the sorted DataRowView objects in customersDV are as follows AROUT Around the Horn UK BSBEV B s Beverages UK CONSH Consolidated Holdings UK EASTC Eastern Connection UK ISLAT Island Trading UK NORTS North South UK SEVES Seven Seas Imports UK The following example calls the Find method to find the index of the DataRowView in customersDV with a CustomerID of BSBEV int index BSBEV Because BSBEV occurs at index 1 the Find method returns 1. Note DataRowView objects in a DataView start at index 0. Therefore BSBEVoccurs at index 1. Finding DataRowView Objects Using the FindRows Method The FindRows method of a DataView finds and returns an array of DataRowView objects for which the primary key column matches the primary key in your DataView. If no rows were found then the returned array will have zero elements and the Length property of the array will be 0. To find DataRowView objects using the FindRows method you must first set the Sort property of your DataView to sort on the primary key. For example if you want to find DataRowView objects based on the CustomerID you .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.