Results 1 to 3 of 3

Thread: updating .mdb from .xml

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2004
    Posts
    48

    updating .mdb from .xml

    Ok..guys i have given up tryin to do this...maybe i'm not doing the right thing...wat i have to do is read the customers table from northwind and if the database is not available(renamed) read the .xml file. but when the northwind databse becomes available, update the changes made in the .xml file to the northwind database . i hope i explained it right. so this is the cod i have....

    'Loads the database to the datagrid and writes a .XML file
    Private Sub cmdLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdWriteXML.Click
    Try
    DataSet11.Clear()
    OleDbDataAdapter1.Fill(DataSet11)
    DataSet11.WriteXml("Customers.xml")
    MsgBox("Successfully read from Database")
    cmdUpdate.Enabled = True
    Catch ex As Exception
    'If an exception has occured read the .XML file
    Call prcReadXML()
    cmdUpdateXmL.Enabled = True
    End Try
    End Sub

    'reads the .xml file if the database is not Available
    Public Sub prcReadXML()
    MsgBox("The database has been renamed or is not available. Reading the XML File")
    DataSet11.ReadXml("Customers.xml")
    dgXML.SetDataBinding(DataSet11, "Customers")
    End Sub

    'Updates the database and the .xml file if the database is available
    Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click
    Try
    DataSet11.WriteXml("Customers.xml")
    OleDbDataAdapter1.Update(DataSet11)
    Catch ex As Exception
    MsgBox("Field could not be updated")
    End Try
    End Sub

    'updates the .xml file if the databse is NOT available
    Private Sub cmdUpdateXmL_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdateXmL.Click
    Try
    DataSet11.WriteXml("Customers.xml")
    Catch ex As Exception
    MsgBox("Field could not be updated")
    End Try
    End Sub


    Thanks in advance...i know the code is lengthy but it is easy 2 understand....i tried to make the code look better in here...but it doesnt change
    Last edited by dawgfather; Apr 1st, 2004 at 09:17 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width