TAILIEUCHUNG - Microsoft ADO .NET 4 Step by Step - p 13

Cũng như các đơn bảng tổng hợp, biểu thức có thể tham khảo bất kỳ cột có giá trị trong bảng con, kể cả cột biểu hiện khác. Xem xét các mã sau đây, mà tính toán tổng số đơn đặt hàng của từng khách hàng và lưu trữ các kết quả trong một cột biểu hiện trong bảng (mẹ) của khách hàng: | 96 Microsoft 4 Step by Step As with single-table aggregation the expression can reference any valid column in the child table including other expression columns. Consider the following code which calculates each customer s total orders and stores the result in an expression column in the customer parent table C ----- Build the parent table and add some data. DataTable customers new DataTable Customer ID typeof int Name typeof string new Object 1 Coho Winery new Object 2 Fourth Coffee ----- Build the child table and add some data. The Total expression column adds sales tax to the subtotal. DataTable orders new DataTable Order ID typeof int Customer typeof int Subtotal typeof decimal TaxRate typeof decimal Total typeof decimal Subtotal 1 TaxRate ----- Two sample orders for customer 1 1 for customer 2. new Object 1 1 Total new Object 2 1 Total new Object 3 2 Total ----- Link the tables within a DataSet. DataSet business new DataSet customers orders ID Customer ----- Here is the aggregate expression column. OrderTotals typeof decimal Sum ----- Display each customer s order total. foreach DataRow scanCustomer in string scanCustomer Name 0 c decimal scanCustomer OrderTotals Chapter 6 Turning Data into Information 97 Visual Basic ----- Build the parent table and add some data. Dim customers As New DataTable Customer ID GetType Integer Name GetType String 1 Coho Winery 2 Fourth Coffee ----- Build the child table and add some data. The

TÀI LIỆU MỚI ĐĂNG
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.