Processing a Batch SQL Statement

[ Team LiB ] Recipe Processing a Batch SQL Statement Problem You have a batch SQL query that returns multiple result sets and you need to work with the result sets in . Solution Use the NextResult( ) | Team LiB Recipe Processing a Batch SQL Statement Problem You have a batch SQL query that returns multiple result sets and you need to work with the result sets in . Solution Use the NextResult method to iterate through and process SQL queries that return multiple result sets. The sample code contains three event handlers Go Defines a SQL batch query statement that selects all Orders and Order Details records from Northwind. Depending on the radio button checked by the user either a DataAdapter is used to fill a DataSet with multiple tables or a Command object is used to create a DataReader containing multiple result sets. In either case the results are displayed in a data grid for the DataSet and in a text box for the DataReader. DataSet RadioButton. CheckedChanged Displays a data grid to show the results of a batch query when loaded into a DataSet. Hides the text box for the DataReader results. DataReader Displays a text box to show the results of a batch query when loaded into a DataReader. Hides the data grid for the DataSet results. The C code is shown in Example 2-3. Example 2-3. File Namespaces variables and constants using System using using using using Table name constants private const String ORDERS_TABLE Orders private const String ORDERDETAILS_TABLE OrderDetails Field name constants private const String ORDERID_FIELD OrderlD Relation name constants private const String ORDERS_ORDERDETAILS_RELATION Orders_OrderDetails_Relation . . . private void goButton_Click object sender e Batch SQL query returning two result sets String sqlText select OrderID CustomerID EmployeeID OrderDate RequiredDate ShippedDate ShipVia Freight ShipName ShipAddress ShipCity ShipRegion ShipPostalCode ShipCountry FROM Orders SELECT OrderID ProductID UnitPrice Quantity Discount FROM Order Details if

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
6    345    2    01-05-2024
10    66    2    01-05-2024
Đã 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.