Solved

Create an xml database for an application

Posted on 2008-06-19
5
132 Views
Last Modified: 2010-04-23
I have started a windows application and imported some file from sql server for the data source. I am thinking I may want to go a different way though. I am leaning towards using an xml database instead. Reason being I have been reading about read/write and I want to have (I hope) and pocket pc application to sync with the desktop application. I was researching xml on the web and it looks possible. I think this would be the best way to go.

I no nothing about even creating the xml file to start with. Can I take an existing table and use that? Should I just create the xml file from the form?

Any good tutorials would be appreciated.
0
Comment
Question by:wiswalld
  • 3
  • 2
5 Comments
 
LVL 19

Accepted Solution

by:
elimesika earned 500 total points
ID: 21823730
0
 
LVL 13

Author Comment

by:wiswalld
ID: 21824824
How would I create the original xml file from my current dataset in my application. If I have 4 tables and I want an xml file for the xml database
0
 
LVL 13

Author Comment

by:wiswalld
ID: 21824872
The original database was created in sql server ce 2005 (I know not the norm) and added to the project using add datasource. I then have 4 tables in my datasource. But I want to make them into xml
0
 
LVL 19

Expert Comment

by:elimesika
ID: 21828889
0
 
LVL 13

Author Comment

by:wiswalld
ID: 21833544
That does not looks like it create a new xml document (database). I know how to create a document from scratch like

 Dim colProd As New DataColumn("Player")
        colProd.ColumnMapping = MappingType.Attribute
        Dim col1 As New DataColumn("Handicap")
        col1.ColumnMapping = MappingType.Attribute
        Dim col2 As New DataColumn("PlayerID")
        col2.ColumnMapping = MappingType.Attribute
        Dim dt As New DataTable("tblHandicap")
        dt.Columns.AddRange(New DataColumn() {colProd, col1, col2})
        '*** Create rows and add to Table
        Dim row As DataRow
        row = dt.NewRow()
        row.Item("Player") = "John Doe"
        row.Item("Handicap") = "18"
        row.Item("PlayerID") = "2"
        dt.Rows.Add(row)

        '*** End create rows and add to Table

        '*** Write data out to file
        dt.WriteXml("c:\DVADGolf\DVADGolf.xml")
        MsgBox("Done")

I even know how to add data like

 Dim path As String = "c:\DVADGolf\DVADGolf.xml"

        Dim ds As New DataSet()
        ds.ReadXml(path)    'read the XML file into memory

        'Add a new record to the 1st table in the DataSet:
        Dim row As DataRow = ds.Tables(0).NewRow()

        'Update a value:
        row.Item(0) = Me.TextBox1.Text
        row.Item(1) = Me.textbox2.text
        row.Item(2) = Me.textbox3.text

        ds.Tables(0).Rows.Add(row)    '< add the row to the table

        'Write it back out again:
        ds.WriteXml(path, XmlWriteMode.WriteSchema)

        ds.Dispose()






Thats all good. But I imported an sdf file from sql server ce into a visual studio windows application creating a new dataset. I don't want to use that dataset just create an xml document (database) from that to use as my dataset. So another words I need an xml document with multiple tables.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

805 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question