Đang chuẩn bị liên kết để tải về tài liệu:
Nested XML

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Nested XML As mentioned in Chapter 10, "Using DataSet Objects to Store Data," a DataSet contains two methods that output the contents of the DataRow objects as XML | Nested XML As mentioned in Chapter 10 Using DataSet Objects to Store Data a DataSet contains two methods that output the contents of the DataRow objects as XML GetXml returns the XML representation of the data stored in the DataSet object as a string. WriteXml writes the data from the DataSet object out to an XML file. A DataRelation contains a property named Nested that gets or sets a bool value that indicates whether the DataRelation objects are nested. This is useful when defining hierarchical relationships in XML. Specifically when you set Nested to true the child rows are nested within the parent rows in any XML that you output using the GetXml and WriteXml methods. Similarly you can read the nested rows when calling the ReadXml method of a DataSet to read an XML file. The following example sets a DataRelation object s Nested property to true myDataSet.Relations CustomersOrders .Nested true This is shown in Listing 12.1. Notice that this program writes two XML files named nonNestedXmlFile.xml and nestedXmlFile.xml. The nonNestedXmlFile.xml contains the default non-nested rows and nestedXmlFile.xml contains the nested rows after the DataRelation object s Nested property is set to true. Listing_12.1 NESTEDXML.CS NestedXml.cs illustrates how setting the Nested property of a DataRelation to true causes the the child rows to be nested within the parent rows in the output XML using System using System.Data using System.Data.SqlClient class NestedXml public static void Main SqlConnection mySqlConnection new SqlConnection server localhost database Northwind uid sa pwd sa SqlCommand mySqlCommand mySqlConnection.CreateCommand mySqlCommand.CommandText SELECT TOP 2 CustomerlD CompanyName FROM Customers ORDER BY CustomerlD SELECT OrderlD CustomerlD ShipCountry FROM Orders WHERE CustomerlD IN SELECT TOP 2 CustomerlD FROM Customers ORDER BY CustomerlD SqlDataAdapter mySqlDataAdapter new SqlDataAdapter .

TÀI LIỆU LIÊN QUAN
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.