TAILIEUCHUNG - Creating Child DataView Objects

Creating Child DataView Objects You can create a child DataView from a parent DataRowView using the CreateChildView() method. You can then view the DataRowView objects from the child DataView. | Creating Child DataView Objects You can create a child DataView from a parent DataRowView using the CreateChildView method. You can then view the DataRowView objects from the child DataView. To call the CreateChildView method you must first add a DataRelation to the DataSet that defines a relationship between the two underlying DataTable objects. See Chapter 12 Navigating and Modifying Related Data for information about DataRelation objects. Let s take a look at an example. Assume you have two DataTable objects named customersDT and ordersDT. Also assume you ve added the following DataRelation to the DataSet that defines a relationship between customersDT and ordersDT DataRelation customersOrdersDataRel new DataRelation CustomersOrders CustomerID CustomerID customersOrdersDataRel Finally assume you have a DataView named customersDV that views the customers that have a Country column of UK. You can then call the CreateChildView method from a DataRowView in customersDV to create a child DataView notice that the name of the DataRelation CustomersOrders is passed to the CreateChildView method DataView ordersDV customersDV 0 .CreateChildView CustomersOrders The ordersDV DataView allows you to access the child rows from the ordersDT DataTable. The parent in this example is the first DataRowView from customersDV with a CustomerID of AROUT. The child ordersDV DataView contains DataRowView objects with the details of the orders for the AROUT customer. Note The CreateChildView method is overloaded. The other version of this method accepts a DataRelation object as the parameter. Listing shows a complete example program. Listing illustrates how to create a child DataView using System using using class CreateChildDataView public static void Main SqlConnection mySqlConnection new SqlConnection server localhost database Northwind .

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.