|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
XML into SQL 2005 Express using VB 2005Hi
I am newbie when it comes to this so please be gentle. What I want to do is read in data from XML files (1 contains on 1 record per file the other can contain upward of 500 records) and then write the data out to SQL 2005 Express. The xml file names will be variable but always read from the same location then moved once processed. Any pointers on howto do this or links to articles that describe how to do this type of thing in VB 2005. Thanks D49 D49,
The most easiest way to read XML files in Net is as they are readable as DataSets. I am not known with Epress, but you can try that by opening your XML file in Solution Explorer from Express and than to drag it on your workplace. If that goes and you see a table, than you can read it with dim ds as dataset ds.readxml("thepath"). If that is impossible than is the next step the XMLNodeReader. If that does not go the common Document Load is usable, but that is the hardest one to use. I hope this helps sofar, Cor <dfourn***@gmail.com> schreef in bericht Show quoteHide quote news:1153790379.117131.64680@i3g2000cwc.googlegroups.com... > Hi > I am newbie when it comes to this so please be gentle. What I want to > do is read in data from XML files (1 contains on 1 record per file the > other can contain upward of 500 records) and then write the data out to > SQL 2005 Express. The xml file names will be variable but always read > from the same location then moved once processed. Any pointers on howto > do this or links to articles that describe how to do this type of thing > in VB 2005. > > Thanks > > D49 > What Cor posted is correct but just to clairify....
Since the file names vary you can get it like this: Private Sub LoadFiles() Dim DsData As New DataSet Dim Files() As String Dim File As String Dim dtTable As DataTable Dim drRow As DataRow Files = IO.Directory.GetFiles("C:\DirectoryPath") For Each File In Files dsData.ReadXml(File) Next For Each dtTable In dsData.Tables For Each drRow In dtTable.Rows 'This is where you'll update your database with row data. Next Next End Sub Hope this helps. dfourn***@gmail.com wrote: Show quoteHide quote > Hi > I am newbie when it comes to this so please be gentle. What I want to > do is read in data from XML files (1 contains on 1 record per file the > other can contain upward of 500 records) and then write the data out to > SQL 2005 Express. The xml file names will be variable but always read > from the same location then moved once processed. Any pointers on howto > do this or links to articles that describe how to do this type of thing > in VB 2005. > > Thanks > > D49
Windows Service Cannot Move Files
Stopping Attributes.Add from converting my JavaScript event code to HTML 2 Gig Print Spooler process Fastest way to update a Picturebox's image Dispose of Notifier Icon Dynamic Properties hiding properties or methods in inherited class Sub Main Ends so does the application Editing XML Document VB Express |
|||||||||||||||||||||||