Answered XML / SQL

  • Sunday, May 01, 2005 5:21 PM
     
     
    I'm going to show my ignorance or perhaps my hm....

    The app that I'm rewriting for .NET has such static data that it could live quite nicely on something as simple as memory dumps of the tables. More generally XML seems the way to go.

    There are very rare cases where an sql select statement would be nice. Is there any combination of ingredients that allows for the application of sql with out the need for an sql server?

    Slightly more generally I guess what I'm asking is given the xml flat table popluated with data is there a way to "import it" so that it shows up as dataset complete with some kind of table adapter?

    Even more gnenerally is there away to write a connect string to an xml file?

    Do these questions even make sense?

    Regards,
    Al
     
    What I have not figured out is

All Replies

  • Sunday, May 01, 2005 8:44 PM
     
     Answered
    1. You can't use SQL on an Xml file but using the XmlDocument class you can use XPath, which is similar (http://www.w3schools.com)
    2. If you want to read your XML into a dataset you can use

    DataSet ds = new DataSet();

    ds.ReadXml("file.xml");

    3. No you can't write a connection string for an XML file.
  • Monday, May 02, 2005 5:01 PM
     
     
    The System.Data.DataSet class has a ReadXml method.  It will "infer" the tables from what it finds in your XML.  It can also do a better job if you provide it with an XSD schema.