HOW TO: ????? ?????? XML ??? DataSet ???????? Visual Basic .NET

?????? ????????? ?????? ?????????
???? ???????: 309702 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ????? ????? "??????? ??????? ???????" ???????? ??? (XML) ??? ???? ADO.NET DataSet.

???????

???? ??????? ??????? ??????? ?????? ??? ????? ?????? ???????? ?????? ? ??? ??????? ???? ???????:
  • Microsoft Windows 2000 Professional, Windows 2000 Server Windows 2000 ?????? ???? ?? ???? Windows NT 4.0
  • Microsoft Visual Studio .NET
????? ??? ??????? ??? ??????? ??? ???????? ???????:
  • Visual Studio .NET
  • ??????? ADO.NET ????? ??????
  • ??????? XML

??? ?????

????? ??????? ??????? ReadXml ????? ???????? "?" ???? XML ??? DataSet. ???? ????? ?????? XML ?????? ?? ???? ?? ???? ??? ???? XmlWriter ?? ???? TextWriter.

????? ??????? ???? ??????? ?????? overloaded ??????? ReadXml ???????? ??? ?????????. ????? ????? ????? ??????? ???? ??? ???? ?????? overloaded. ?????? ?????? ?? ???? ???? ???????? overloaded ????? ?????? (XmlReadMode) ?? ???? ???????? ?? ???????? ??????.

???? ??????? ??????? ??? ?????? ?? ?????? overloaded ???? ????? ?????:
  • ?????? ???????? ???????? ??????? ??? ???? ????? ???????? "?" ???? XML ??? DataSet:
    Overloads Public Sub ReadXml(String)
    					
  • ?????? ???????? ???????? ??????? ???? TextReader ????? ???????? "?" ???? XML ??? DataSet. ?? ????? TextReader ?????? ??????.
    Overloads Public Sub ReadXml(TextReader)
    					
  • ?????? ???????? ???????? ??????? ???? System.IO.Stream ????? ???????? "?" ???? XML ??? DataSet. ?? ????? ????? ??? ?????? ??????? ????????.
    Overloads Public Sub ReadXml(Stream)
    					
  • ?????? ???????? ???????? ??????? ???? XmlReader ????? ???????? "?" ???? XML ??? DataSet. ???? ??? ??????? ????? "?" ??? ??????? ? ????? - ??? ??????? ??? ?????? XML ???? ?????? ?? XML "????? ???? ??? ????????" (W3C) 1.0 ??????? ? ?????? ??????? ?? ??????? XML.
    Overloads Public Sub ReadXml(XmlReader)
    					
???? ??????? ?? ???? ???????? ??????? ?? ?????? overloaded ?????? XmlReadMode ?? ??? ???????? above-mentioned. ????? ????? XmlReadMode ????? ????? ?????? XML ????? ??? DataSet.
  • DiffGram. ?????? DiffGram ????? ?????? ????????? ?? DiffGram ??? DataSet.
  • ?????. ???? ??????? XML ???? ????? ??? ?????? XML "??????? ???????" (XDR) ????? ?????? (??? ??? ???? ??? ??????? ??? ????? ?????? XML FOR ???? ????? ???? XDR ????? ????? ???? Microsoft SQL Server) ???????.
  • IgnoreSchema. ?????? ?? ???? ???? ?? ???? ???????? ??? ?????? DataSet ????????.
  • InferSchema. ?????? ?? ???? ???? infers ?????? ?? ???????? ?? ????? ????????. ??? ??? ????? DataSet ???? ? InferSchema ????? ?????? ?????? ?????? ????? ????? ??? ????? ?????? ??????? ????? ??????? ??????? ??? ?? ??? ?????? ?? ?????.
  • ReadSchema. ?????? ?? ???? ???? ????? ?????? ????????.
  • ??????. ?????????. ????? ??????? ?????? ??????.

????? ????? ?? ????? ???

?????? ??? ?????? ??? ??? ???? MySchema.xml. ?????? MySchema.xml ???? ??????? ??????? ?? ??????? ??????? ??????? ????? Microsoft:
308064HOW TO: ??????? ADO.NET DataSet ?? XML ???????? Visual Basic .NET
???? ????? ????????? ???????? ?????? ????? ??????? ????? ????????? ??????? overloaded ReadXml. ?????? ??? ????? ???? ???? MSDN ?????? ??????? ?????? ??????? ?? ??? ???????.
  1. ??? ????? Visual Studio .NET.
  2. ????? ????? ????? Windows ???? ?? Visual Basic .NET. ??? ????? Form1 ??? ??????? ???? ???????.
  3. ???? ?? ?? ????? ??????? ??? ???? ??? ????? ????? System.Data ?? ????? ???? ??? ????? ??????? ??? ??? ?? ???.
  4. ?? ????? ???? ?? ?????? ???? DataGrid ???? ??? Form1. ????? ????? ??? Button1 ??? btnReader ?????? ??????? Text ????? ?? ??? ??????.

    ????? ????? ??? Button2 ??? btnFile ?????? ??????? Text ????? ?? ??? ???.
  5. ?????? ??????? ?????? ????????? ??? ?????? ????? ????System.Data ? System.Data.SqlClient ???? ??? ?????? ????? ????????? ?? ????? ??????? ?????? ?? ????????? ????????.
    Imports System
    Imports System.Data
    Imports System.Data.SqlClient
    					
  6. ?? ?????? "??????? ??????" ? ?? ?????? ????????? ???????? ??????? ??? ??????? "???? ????? Windows ????? ????????? ????????":
    Private Sub btnReader_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnReader.Click
        Dim myXMLfile As String = "C:\MySchema.xml"
        Dim ds As New DataSet()
        ' Create new FileStream with which to read the schema.
        Dim fsReadXml As New System.IO.FileStream _
            myXMLfile, System.IO.FileMode.Open)
        Try
            ds.ReadXml(fsReadXml)
            DataGrid1.DataSource = ds
            DataGrid1.DataMember = "Cust"
        Catch ex As Exception
            MessageBox.Show(ex.ToString())
        Finally
            fsReadXml.Close()
        End Try
    End Sub
     
    Private Sub btnFile_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnFile.Click
        Dim myXMLfile As String = "C:\MySchema.xml"
        Dim ds As New DataSet()
        Try
            ds.ReadXml(myXMLfile)
            DataGrid1.DataSource = ds
            DataGrid1.DataMember = "Cust"
        Catch ex As Exception
            MessageBox.Show(ex.ToString())
        End Try
    End Sub
    					
  7. ?? ?????? ?????? ??? ??? XML (myXMLfile) ??? ?? ????? ?????? ?????? ??.
  8. ??? ??????? ????? ??. ?? ??????? ????? ? ???? ??? ???? ????? ???????.
  9. ???? ??? ?? ?? ????? ????? ?????? XML ?? ????? ??????. ???? ???? ?????? XML ?? ??????.

??????? ??????

  • ????? ???? XML ? ???? ??????? ??????? ReadXmlSchema.
  • ?????? ??? ????? XML ???????? ?? DataSet ????? ?? persisting ??? ??? ?? ???, ????? ??????? ??????? GetXml.

?????

?????? ??? ??????? ??????? ???? ??? ???? ????????? ????????? ??????? ?? "????? ??????? ?? Microsoft:
308064HOW TO: ??????? ADO.NET DataSet ?? XML ???????? Visual Basic .NET
262450HOWTO: C++ ????? ?? ?????? XML ?????? ??????? ADO
?????? ??? ???? ?? ????????? ??? ?????? ADO.NET ???? ???? ???? ????? Microsoft .NET Framework ????? ?????? ??????? (SDK) ??????? ?? MSDN ??? ??????:
?????? ??? ???????? ???????? ADO.NET
http://msdn2.microsoft.com/en-us/library/e80y5yhx(vs.71).aspx

???????

???? ???????: 309702 - ????? ??? ??????: 26/???? ??????/1428 - ??????: 2.2
????? ???
  • Microsoft ADO.NET (included with the .NET Framework)
  • Microsoft ADO.NET 1.1
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft Visual Basic .NET 2003 Standard Edition
????? ??????: 
kbmt kbhowtomaster kbsqlclient kbsystemdata KB309702 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????309702

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com