none
XML into DataSet RRS feed

  • General discussion

  • How to import text xml into DataSet?

     

    Here's a method...

     

    string xmloutput = @" <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <departments xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <department>
        <code>01</code>
        <description>Finance Department</description>
     </department>
     <department>
        <code>02</code>
        <description>Human Resource Department</description>
     </department>
    </departments>";

     

    string strxml = xmloutput;

    StringReader sr = new StringReader(strxml);

    DataSet ds = new DataSet();

     

    ds.ReadXml(sr);

    • Moved by CoolDadTx Wednesday, May 23, 2012 1:43 PM ADO.NET related (From:Visual C# IDE)
    Friday, June 1, 2007 7:11 PM

All replies

  • Refer Following urls

    http://stackoverflow.com/questions/894451/import-xml-into-dataset-c-sharp


    http://msdn.microsoft.com/en-us/library/ekw4dh3f(v=vs.71).aspx

    http://msdn.microsoft.com/en-us/library/ekw4dh3f.aspx

    http://forums.devx.com/archive/index.php/t-55719.html


    Gehan Fernando Snr. Engineer Technology. AKLO Information Technologies (Pvt) Ltd. #58, 42nd Lane, 5th Floor, Wellawatta, Colombo 06, Sri Lanka. Phone: +94 117 520000 | Mobile: +94 772 269625

    Wednesday, May 23, 2012 10:29 AM

  • DataSet ds = new DataSet();

     

    ds.ReadXml(thepath);

    is enough

    Although the question is from 2007



    Success
    Cor


    Tuesday, May 29, 2012 9:29 AM