tailieunhanh - Beginning Visual Basic .NET Database Programming phần 8

Tại thời điểm này, chúng ta biết làm thế nào để tải và lưu dữ liệu XML trực tiếp sử dụng tập hợp dữ liệu. Chúng tôi cũng biết làm thế nào để tạo ra các lược đồ và làm thế nào để sử dụng các lược đồ để xác nhận. Tuy nhiên, vào thời điểm này, chúng tôi đã chỉ nhìn thấy những gì sẽ xảy ra khi chúng ta có một bảng duy nhất. | and XML Relational Data At this point we know how to load and save XML data directly using the DataSet. We also know how to generate schemas and how to use those schemas for validation. However at this point we ve only seen what happens when we have a single table. As we ve already seen in earlier chapters the DataGrid control is capable of letting us navigate around different tables pretty easily. In this section we ll extend what we have so that when we have an order shown in the DataGrid we can drill down to see the lines that make up that order. Try It Out - Relating the Order Details Table 1. If the project is running close it. 2. Using the code editor find the code for Forml. Make these changes to btnConnect_Click. Private Sub btnConnect_Click ByVal sender As _ ByVal e As Handles Connect to the database. Dim connection As New sqlconnection DbString Create a new dataset Dim newDataset As New DataSet Orders Create a new table to hold the orders in. Dim ordersTable As New DataTable Order ordersTable Load the last two orders from the database. Dim command As New SqlCommand SELECT TOP 2 OrderID CustomerID _ EmployeeID OrderDate RequiredDate ShippedDate _ ShipVia Freight ShipName ShipAddress ShipCity _ ShipRegion ShipPostalCode ShipCountry FROM Orders _ ORDER BY OrderID DESC connection Fill the dataset. Dim adapter As New SqlDataAdapter command ordersTable Create a new table to hold the order details on. Dim detailsTable As New DataTable Detail detailsTable Form a SQL string so that we only get the details that are included in the first table. Dim sql As String row As DataRow For Each row In Create a sql snippet. If sql Then sql or 25 Chapter 12 sql OrderID row orderid Next Do we need to bother If sql Then Create a new command. sql SELECT OrderID ProductID UnitPrice Quantity Discount _ FROM Order Details WHERE sql Dim .

crossorigin="anonymous">
Đã 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.