Share via


Serialising an ADOMD.net CellSet object

I'm grateful to T.K. Anand for this useful code snippet which is useful if you're writing a web services client that consumes OLAP data.

The following Adomd.net code can be used for saving and loading cellsets…

Save:
            XmlReader xmlReader = command.ExecuteXmlReader();
            string xml = xmlReader.ReadOuterXml();
            StreamWriter streamWriter = File.CreateText("CellSet.xml");
            streamWriter.WriteLine(xml);
            streamWriter.Close();

Load:
            XmlTextReader xmlTextReader = new XmlTextReader("CellSet.xml");
            CellSet cellSet = CellSet.LoadXml(xmlTextReader);