Load XML into a Dataset [C#/.NET]
If you’re working with XML files in .NET, the easiest thing to do is load the XML in as a DataTable:
using System.Data.SqlClient;public DataTable ReturnDataTbl(string XmlFile) { DataSet dset = new DataSet();FileStream fstr = new FileStream(XmlFile, FileMode.Open, FileAccess.Read); dset.readXml(fstr);DataTable dtbl = dset.Tables[0];fstr.Close(); dset.Dispose();return dtbl; }
You can now run a SELECT, UPDATE or any SQL statement on it directly.


could you please tell me how sql-querrys on datasets work?
thanks in advance
Hi,
I’m wondering how to excecute the sql statement on the datatable? Could you please show us how or which method / property to use?
Thank you,
Johan
If you specify the schema the XML file is parsed and ready much faster. This may only really apply to big XML files though.
Shane
Thanks for your code lines …