⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datasets.vb

📁 wrox出版社的另一套经典的VB2005数据库编程学习书籍,收集了书中源码,郑重推荐,电子书,电子书下载
💻 VB
字号:
Option Explicit On
Option Strict On

Imports System.Data
Imports System.IO

Public Class DataSets
    Private strPath As String
    Private strFile As String
    Private strXML As String
    Private Const strIEFile As String = "\Program Files\Internet Explorer\Iexplore.exe"

    Private Sub DataSets_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        strPath = Application.StartupPath
    End Sub

    Private Sub btnNWAttribs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNWAttribs.Click
        Dim dsAttribs As New DataSet
        strFile = strPath + "\NWAttribs.xml"
        If File.Exists(strFile) Then
            With dsAttribs
                'Infer the schema
                .ReadXml(strFile)
                'Write the output document
                Dim strXmlFile As String = strPath + "\NWAttribs.xml"
                .WriteXml(strXmlFile, XmlWriteMode.IgnoreSchema)
                'Write the inferred schema
                Dim strXsdFile As String = strPath + "\NWAttribs.xsd"
                .WriteXmlSchema(strXsdFile)
                Shell("""" + strIEFile + """ " + strXmlFile, AppWinStyle.NormalFocus)
            End With
        End If
    End Sub

    Private Sub btnLoadNwDs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadNwDs.Click
        With Me.NorthwindDS
            strFile = strPath + "\NorthwindDS.xml"
            If File.Exists(strFile) Then
                .ReadXml(strFile)
                strFile = strPath + "\Output.xml"
                .WriteXml(strFile, XmlWriteMode.IgnoreSchema)
                Shell("""" + strIEFile + """ " + strFile, AppWinStyle.NormalFocus)
            End If
        End With
    End Sub

    Private Sub btnShowCustDs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowCustDs.Click
        strFile = strPath + "\CustomersDS.xsd"
        If File.Exists(strFile) Then
            Shell("""" + strIEFile + """ " + strFile, AppWinStyle.NormalFocus)
        End If
    End Sub

    Private Sub btnShowNwXsd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowNwXsd.Click
        strFile = strPath + "\NorthwindDS.xsd"
        If File.Exists(strFile) Then
            Shell("""" + strIEFile + """ " + strFile, AppWinStyle.NormalFocus)
        End If
    End Sub

    Private Sub btnShowNwAttribsXsd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowNwAttribsXsd.Click
        strFile = strPath + "\NWAttribs.xsd"
        If File.Exists(strFile) Then
            Shell("""" + strIEFile + """ " + strFile, AppWinStyle.NormalFocus)
        End If
    End Sub

    Private Sub btnLoadCustsDs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadCustsDs.Click
        With Me.CustomersDS
            strFile = strPath + "\CustomersDS.xml"
            If File.Exists(strFile) Then
                .ReadXml(strFile)
                strFile = strPath + "\Output.xml"
                .WriteXml(strFile, XmlWriteMode.IgnoreSchema)
                Shell("""" + strIEFile + """ " + strFile, AppWinStyle.NormalFocus)
            End If
        End With
    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -