MSACCESS export to XML read file into VB .Net dataset

B

BobAchgill

I am trying to read in a xml file that I exported from my
MSAccess table using the following lines of code but it
bombs. Is this the right code? Is there a way to get a
clean export from Access so the XML file will read in OK
into a VB .Net Form dataset?


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

Dim myDS As DataSet = New DataSet
myDS.ReadXml
("MyAccessTableExportedtoXML.xml", XmlReadMode.
ReadSchema)

End Sub
==============================
 
K

Ken Tucker [MVP]

Hi,

You are only trying to read in the table structure. Try this
instead.

myDS.ReadXml("MyAccessTableExportedtoXML.xml")

Ken
-----------
I am trying to read in a xml file that I exported from my
MSAccess table using the following lines of code but it
bombs. Is this the right code? Is there a way to get a
clean export from Access so the XML file will read in OK
into a VB .Net Form dataset?


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

Dim myDS As DataSet = New DataSet
myDS.ReadXml
("MyAccessTableExportedtoXML.xml", XmlReadMode.
ReadSchema)

End Sub
==============================
 
B

BobAchgill

Hi Ken,

I tried what you said and it is still bombing. Any more
ideas? What imports should I be using?

I chose Embed Schema in exported XML document when
exporting the table from MSAccess.

Thanks!

Bob

PS Here is the code and Error
++++++++++++++++++++++++++++++++++++
Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "


Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
Dim myDS As DataSet = New DataSet
'myDS.ReadXml("MyAccessTableExportedtoXML.xml",
XmlReadMode.ReadSchema)
myDS.ReadXml("MyAccessTableExportedtoXML.xml")
End Sub
End Class


===ERROR=================================
An unhandled exception of type 'System.ArgumentException'
occurred in system.data.dll

Additional information: The schema namespace is invalid.
Please use this one instead:
http://www.w3.org/2001/XMLSchema.
==========================================
 
P

Paul Clement

¤ I am trying to read in a xml file that I exported from my
¤ MSAccess table using the following lines of code but it
¤ bombs. Is this the right code? Is there a way to get a
¤ clean export from Access so the XML file will read in OK
¤ into a VB .Net Form dataset?

Is there a reason why you're exporting to XML instead of reading the data directly from Access?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top