?
Solved

Importing XML files into SQL Server 2000 tables

Posted on 2009-05-13
2
Medium Priority
?
406 Views
Last Modified: 2013-11-26
I am new to vb.net and importing the data in the xml documents into a sql tables.  I am wondering the best to approach this project.  The xml files that I need to import into a sql table will be in one folder.  So I am unsure on how to process the first file in the folder move the data into my sql table then move on to the next file until all the data on the xml files has been imported into my sql table.  Can anyone point me in the direction of how to code it properly so all xml files in the directory are read and also an example of how to take those xml fields and import them into my sql table?  Please advise.
0
Comment
Question by:v4seasons
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 1000 total points
ID: 24382326
Its not a 250 points question but anyway try using this code.

Note that you would have a dbconnection already open and a dbcmd as sqlcommand already configured.
Dim dTable as new DataTable
For each File in io.directory.getfiles("C:\XML")
    dTable.ReadXML(File)
    for i as integer = 0 to dTable.rows.count - 1
        dbcmd.commandtext = "Insert Into Table(column1, column2, ...) Values('" & dTable.rows(i).item(0) & "', '" & dTable.rows(i).item(1) ...
        dbcmd.executenonquery()
    next
    dTable.Clear()   
Next

Open in new window

0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question