TAILIEUCHUNG - Using the Shape Language to Retrieve Hierarchical Data

[ Team LiB ] Recipe Using the Shape Language to Retrieve Hierarchical Data Problem You want to use the Shape language with to retrieve hierarchical data from a SQL Server. | Team LiB Recipe Using the Shape Language to Retrieve Hierarchical Data Problem You want to use the Shape language with to retrieve hierarchical data from a SQL Server. Solution Execute the SHAPE command as shown in the following example using the OLE DB provider. The sample code defines a SHAPE query to retrieve the TOP 5 Orders from Northwind and the Order Details for each of the Orders. A DataReader based on the query is created. The code iterates over the rows in the DataReader displaying the data for each Order row. If the value for the column can be cast to the IDataReader interface it is a DataReader containing the Order Details for the Order row. The value for the column is cast to a DataReader and the collection of records is iterated over and displayed. The C code is shown in Example 3-14. Example 3-14. File Namespaces variables and constants using System using using using using . . . StringBuilder result new StringBuilder SHAPE SQL to retrieve TOP five Orders and associated Order Detail records. String shapeText SHAPE select TOP 5 from Orders AS Orders APPEND select from Order Details AS Order Details RELATE OrderlD TO OrderlD Create the connection. OleDbConnection conn new OleDbConnection OleDb_Shape_ConnectString Create a command and fill a DataReader with the SHAPE result set. OleDbCommand cmd new OleDbCommand shapeText conn OleDbDataReader orderDR Iterate over the collection of rows in the DataReader. while ORDER Iterate over the collection of Order columns in the DataReader. for int colOrder 0 colOrder colOrder if orderDR colOrder is IDataReader The column is an IDataReader interface. colOrder .ToUpper Create a DataReader for the Order Detail from the .

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.