Converting access data to XML

Discussion in 'XML' started by Parasyke, Jun 14, 2006.

  1. Parasyke

    Parasyke Guest

    Thanks in advance. I'm new to XML. I need to convert an existing Access

    table into XML which will allow me on a form to read the table into
    XML, edit, then reconvert it back to the Access table. I have
    successfully added the Northwind database to my data sources in Visual
    Studio 2003 (Standard Edition). I also have the following code which
    reads from an EXISTING XML file not related to the Access file. How
    could I alter it to pull from Access? Below is the read and Write SUBS
    for the existing XML:

    Private Sub btnLoadXml_Click(ByVal sender As System.Object, ByVal e



    As System.EventArgs) Handles btnLoadXml.Click
    Dim xtr As XmlTextReader = _
    New XmlTextReader("C:\Documents and Settings\dcampbe\My
    Documents\Visual Studio 2005\Projects\310C02\310C02\Books.xml")
    xdd = New XmlDataDocument()
    ds = xdd.DataSet()
    ds.ReadXmlSchema(xtr)
    xtr.Close()
    xtr = New XmlTextReader("C:\Documents and Settings\dcampbe\My
    Documents\Visual Studio 2005\Projects\310C02\310C02\Books.xml")
    xtr.WhitespaceHandling = WhitespaceHandling.None
    xdd.Load(xtr)
    dgXML.DataSource = ds
    dgXML.DataMember = "Book"
    xtr.Close()
    End Sub


    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As



    System.EventArgs) Handles btnSave.Click
    Dim xtw As XmlTextWriter = New XmlTextWriter("C:\Documents and
    Settings\dcampbe\My Documents\Visual Studio
    2005\Projects\310C02\310C02\Books.xml", System.Text.Encoding.UTF8)
    xtw.Formatting = Formatting.Indented
    xdd.WriteTo(xtw)
    'Clean up
    xtw.Close()
    MessageBox.Show("The XML file has been successfully updated !")



    End Sub
    Parasyke, Jun 14, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. H. Kaya
    Replies:
    1
    Views:
    481
    Soren Kuula
    Feb 13, 2004
  2. jkflens
    Replies:
    2
    Views:
    1,446
    jkflens
    May 30, 2006
  3. Replies:
    1
    Views:
    2,950
    M.-A. Lemburg
    Nov 25, 2008
  4. Savvoulidis Iordanis

    XML data access or DB data access ?

    Savvoulidis Iordanis, Jan 7, 2009, in forum: ASP .Net
    Replies:
    2
    Views:
    401
    Savvoulidis Iordanis
    Jan 7, 2009
  5. Elijah Odumosu
    Replies:
    1
    Views:
    178
    Roger Pack
    Apr 29, 2008
Loading...

Share This Page