-
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
-
Hi there,
Can you explain the error or problem that you are having?
______________________________________________
Thanks,
Jeff M.
-
well...the code works fine...all i have to figure out is how 2 update the .mdb file using the .xml file. Thanks for the reply.