TAILIEUCHUNG - Using Expression Columns to Display Aggregate Values

[ Team LiB ] Recipe Using Expression Columns to Display Aggregate Values Problem You want to add summary information such as averages, sums, and counts to a table based on related child rows. Solution Use expression columns to perform aggregate calculations based on child rows. | Team LiB Recipe Using Expression Columns to Display Aggregate Values Problem You want to add summary information such as averages sums and counts to a table based on related child rows. Solution Use expression columns to perform aggregate calculations based on child rows. The sample code starts by creating a DataSet containing the Orders and Order Details tables from Northwind sample database and a relation between them. An expression is added to the Order Details table to calculate the extended price for each row. Aggregate values for the total extended price of the order and the number of Order Detail rows are added to the Orders table. Finally the default view of the Orders table is bound to the data grid to display the results. The C code is shown in Example 3-7. Example 3-7. File Namespaces variables and constants using System using using using Table name constants private const String ORDERS_TABLE Orders private const String ORDERDETAILS_TABLE OrderDetails Relation name constants private const String ORDERS_ORDERDETAILS_RELATION Orders_OrderDetails_Relation Field name constants private const String ORDERID_FIELD OrderlD H . . . DataSet ds new DataSet SqlDataAdapter da Fill the Order table and add it to the DataSet. da new SqlDataAdapter SELECT FROM Orders Sql_ConnectString DataTable orderTable new DataTable ORDERS_TABLE orderTable . Add orderT able Fill the OrderDetails table and add it to the DataSet. da new SqlDataAdapter SELECT FROM Order Details Sql_ConnectString DataTable orderDetailTable new DataTable ORDERDETAILS_TABLE orderDetailTable orderDetailTable Create a relation between the tables. ORDERS_ORDERDETAILS_RELATION ORDERS_TABLE .Columns ORDERID_FIELD ORDERDETAILS_TABLE .Columns ORDERID_FIELD true Create the expression column .

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.