Importing XML into a SQL Server Table

J

Joe Blow

Hi,

I just converted an Access 2002 application into VB.NET (don't ask). VBA in
Access has a nifty command for inporting XML into an Access table call,
unsurprisinglt ImportXML(). It works like this: Application.ImportXML([XML
Filename]). The table name is a field in the .xml file.

So, my question is, how do I do this in VB.NET using MSDE (SQL Server)?
There's a DataSet command called ReadXml that (supposedly) loads a DataSet
with data from a .xml file. But how do I save that data in my SQL Server
database?

I've tried this:

Dim da As DataAdapter = New DataAdapter("SELECT * FROM [tblName]",
sqlDBConn)
Dim ds As New DataSet
ds.ReadXml([XML Filename])
da.Update(ds)

....to no avail. And I've tried:

Dim da As DataAdapter = New DataAdapter("SELECT * FROM [tblName]",
sqlDBConn)
Dim ds As New DataSet
Dim dt As DataTable = ds.Tables.Add"([tblName]")
ds.ReadXml([XML Filename])
da.Update(ds)

....also to no avail. Please help. Thank you.
 

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