Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Tài liệu Using XPath to Query Data in a DataSet doc
MIỄN PHÍ
Số trang
4
Kích thước
15.7 KB
Định dạng
PDF
Lượt xem
1644

Tài liệu Using XPath to Query Data in a DataSet doc

Nội dung xem thử

Mô tả chi tiết

[ Team LiB ]

Recipe 8.6 Using XPath to Query Data in a DataSet

Problem

You need to use an XPath expression to extract certain rows from a DataSet.

Solution

Use SelectSingleNode( ) or SelectNodes( ).

The sample code contains two event handlers:

Form.Load

Sets up the sample by creating a DataSet containing the Orders table and Order

Details table from Northwind and a nested relation between the two tables.

Go Button.Click

Executes an XPath query to retrieve the Orders and Order Details data for an

OrderID specified by the user to an XmlNode. The results are displayed by

iterating over the XmlNode to retrieve the Orders and the XmlNodeList containing

the Order Details.

The C# code is shown in Example 8-9.

Example 8-9. File: XPathQueryForm.cs

// Namespaces, variables, and constants

using System;

using System.Configuration;

using System.Windows.Forms;

using System.Text;

using System.Xml;

using System.Data;

using System.Data.SqlClient;

// Table name constants

Tải ngay đi em, còn do dự, trời tối mất!