How to import XML from web into DataTable?

M

Mika M

Hi!

My DataSet contains DataTable named as 'CurrencyRates', and it contains
fields: 'Currency' (like 'USD'), 'Rate' (like 1.1983) and 'Updated' (date
when updated). My application contains 'Update Currencies'-button, and
pressing it application should update 'Currencies'- DataTable (or insert if
missing currency) of the link
http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml but how to do this ?
I'm using VB .NET 2003 and Windows Forms Application.

I know basics of the .NET and ADO.NET, but my experience is not good enought
for this - for now I hope :) Probably very useful for many peoples to know.
 
M

Mika M

Sorry my writing error earlier, because earlier message (below) contains
mentions about 'CurrencyRates' and 'Currencies' -DataTable. There is only
'CurrencyRates' -DataTable in this case.
 
C

Cowboy \(Gregory A. Beamer\) [MVP]

There are different ways to tackle this.Here are some high level ways I can
think of:

1. Create a process that grabs the XML daily and uses the XML features of
SQL Server to insert the data (OPEN XML). You can then run a simple update
command to move the currency rates over into your other table.

2. You can pull the current records into a DataSet and consume it as XML.
You grab the XML from the site and match nodes based on the "currency"
value. It is a simple matter of moving attribute values for the rate from
one XML doc to the other.

Those are two quick methods. A Service to update a table is the quickest. If
you are not using SQL Server, you will have to walk the values and issue
UPDATE commands against the database, but that is not too hard. Performance
should be fine, as you are dealing with a handful of values only.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
 

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