XML to Database in Winforms C# (or T-SQL)

I would like to know how to do the following...

The application is in Winforms, .NET 3.5 using C#.

There is an html location (not web service) that I can open and that returns multiple records in XML format (see attached).

How can I access this location from Winforms, loop through the records and store them in a defined database table where the table elements match the XML child nodes.

I am familiar on how to do it with Web Services and the WSDL class converter but have never programmed a situation like this.

If there is an alternative to do this directly in a SQL Server stored procedure, I would like to know how to do that.
<supplier>
<priority>5</priority>
<name>CROWN TOWERS</name>
-
<description>The luxurious Crown Towers sets the benchmark for luxury hotels in Australia.</description>
-
<thumbNailLarge>
/apps/ccn/ttc/supubthumbs/S/H/MEL/CRO/Deluxe_Room.jpg
</thumbNailLarge>
<thumbNail>/static/ttc/supub/S/images/H/MEL/CRO/thumb.jpg</thumbNail>
<address line1="8 Whiteman Street" line2="Southbank, VIC 3006" line3="AUSTRALIA"/>
<rating>5</rating>
<webPage>/apps/ccn/ttc/super/S/H/MEL/CRO.html </webPage>
<fromPrice>187.00</fromPrice>
<cityName>MELBOURNE      </cityName>
<consumerBookable>true</consumerBookable>
</supplier>

Open in new window

conrad2010Asked:
Who is Participating?
 
Alexandre SimõesConnect With a Mentor Manager / Technology SpecialistCommented:
To get the XML data use the method presented here:
http://www.west-wind.com/presentations/dotnetWebRequest/dotnetWebRequest.htm

After that I think the easiest way is to use the ReadXml method of the DataSet object.
The DataSet is able to create the schema as it reads the file so you don't have to spend much time with XML Readers.
http://support.microsoft.com/kb/311566

Cheers!
Alex
0
All Courses

From novice to tech pro — start learning today.