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 XSD Schema Files to Load and Save a DataSet Structure pptx
MIỄN PHÍ
Số trang
8
Kích thước
22.0 KB
Định dạng
PDF
Lượt xem
1840

Tài liệu đang bị lỗi

File tài liệu này hiện đang bị hỏng, chúng tôi đang cố gắng khắc phục.

Tài liệu Using XSD Schema Files to Load and Save a DataSet Structure pptx

Nội dung xem thử

Mô tả chi tiết

[ Team LiB ]

Recipe 8.1 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 Button.Click

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 Button.Click

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 Button.Click

Clears the DataGrid and the result text box.

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

Example 8-1. File: XsdSchemaFileForm.cs

// Namespaces, variables, and constants

using System;

using System.Configuration;

using System.Windows.Forms;

using System.Text;

using System.IO;

using System.Xml;

using System.Xml.Schema;

using System.Data;

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