TAILIEUCHUNG - Using XSD Schema Files to Load and Save a DataSet Structure

[ Team LiB ] Recipe Using XSD Schema Files to Load and Save a DataSet Structure Problem You need to create an XSD schema from a DataSet and define the schema of a DataSet from an XSD schema. | Team LiB Recipe Using XSD Schema Files to Load and Save a DataSet Structure Problem You need to create an XSD schema from a DataSet and define the schema of a DataSet from an XSD schema. Solution Use the XmlTextWriter and XmlTextReader classes. The sample code contains three event handlers Write Creates a DataSet containing the Orders table and Order Details table from Northwind and a relation between the two. The XSD schema for the DataSet is written both to a file and to a text box on the form. Read Creates a DataSet and reads in the schema from a file containing a previously serialized XSD schema. The XSD schema is written from the DataSet to a stream and displayed. Clear Clears the DataGrid and the result text box. The C code is shown in Example 8-1. Example 8-1. File Namespaces variables and constants using System using using using using using using using using Table name constants private const String ORDERS_TABLE Orders private const String ORDERDETAILS_TABLE OrderDetails Relation name constants private const String ORDERS_ORDERDETAILS_RELATION Orders_OrderDetails_Relation Field name constants private const String ORDERID_FIELD OrderlD . . . private void writeSchemaButton_Click object sender e DataSet ds new DataSet SqlDataAdapter da Fill the Order table and add it to the DataSet. da new SqlDataAdapter SELECT FROM Orders S ql_ConnectString DataTable orderTable new DataTable ORDERS_TABLE orderTable orderTable orderTable Fill the OrderDetails table and add it to the DataSet. da new SqlDataAdapter SELECT FROM Order Details S ql_ConnectString DataTable orderDetailTable new DataTable ORDERDETAILS_TABLE orderDetailTable .

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.