Click here to Skip to main content
12,296,833 members (63,682 online)
Click here to Skip to main content
Articles » Languages » VB.NET » Applications » Downloads

Stats

83.8K views
5.5K downloads
108 bookmarked
Posted

Xml Database Demo

, 31 Jul 2008 CPOL
This article walks you through creating a simple windows database with an Xml file as it's datasource.
XmlDatabaseDemo
XmlDatabaseDemo
bin
Debug
XmlDatabaseDemo.exe
XmlDatabaseDemo.pdb
XmlDatabaseDemo.vshost.exe
DsXmlDbDemo.xsc
DsXmlDbDemo.xss
My Project
Application.myapp
obj
Debug
TempPE
DsXmlDbDemo.Designer.vb.dll
My Project.Resources.Designer.vb.dll
XmlDatabaseDemo.exe
XmlDatabaseDemo.Form1.resources
XmlDatabaseDemo.pdb
XmlDatabaseDemo.Resources.resources
XmlDatabaseDemo.vbproj.GenerateResource.Cache
XmlDatabaseDemo.suo
Public Class Form1

    Private mXmlFilePath As String = "c:\Temp\XmlDatabaseDemo.xml"

    Private Sub Form1_Load(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles MyBase.Load

        'If the file exists, then read the data from the Xml file
        '  into the DataSet
        If My.Computer.FileSystem.FileExists(mXmlFilePath) = True Then _
            DsXmlDbDemo.ReadXml(mXmlFilePath)

    End Sub

    Private Sub CustomersBindingNavigatorSaveItem_Click( _
        ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles CustomersBindingNavigatorSaveItem.Click

        'Commit the Customer Data and the Orders Data to each
        '  respective DataTable.
        Me.Validate()
        CustomersBindingSource.EndEdit()
        OrdersBindingSource.EndEdit()

        'Write the data from the DataSet out to the Xml File.
        DsXmlDbDemo.WriteXml(mXmlFilePath)

    End Sub

    Private Sub OrdersDataGridView_Enter(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles OrdersDataGridView.Enter

        'Commit the Customer Data to the DataTable
        CustomersBindingSource.EndEdit()

    End Sub

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

CS Rocks
Software Developer DataPrint, LLC
United States United States

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160525.2 | Last Updated 31 Jul 2008
Article Copyright 2008 by CS Rocks
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid