Solved

Importing XML files into SQL Server 2000 tables

Posted on 2009-05-13
2
398 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
2 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 250 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now