Hi All,
this is the code.
String connetionString = "Data Source=;provider=msolap;Connect Timeout=120;Initial Catalog=T_Analytics_database";
AdomdConnection connection = new AdomdConnection(connetionString);
AdomdDataAdapter adapter;
DataTable dt=new DataTable();
string sql = "SELECT CROSSJOIN({[Time].[Year].[Year]}, {[Time].[Month].[Month]},{[Measures].[MAX Newsletter], [Measures].[OLS Application],[Measures].[Total Traded Demos], [Measures].[Total Initial Deposits],[Measures].[Webinar], [Measures].[Total Funded Accounts] }) ON COLUMNS,NON EMPTY({[Match Type].[Match Type].[Match Type]}) ON ROWS FROM [Assigned Form Submission]";
connection.Open();
adapter = new AdomdDataAdapter(sql, connection);
adapter.Fill(dt);
using (XmlWriter writer = XmlWriter.Create(@"D:\Manas\now.xml"))
{ writer.WriteStartDocument();
writer.WriteStartElement("Root");
for (int i = 0; i < dt.Rows.Count; i++)
{
writer.WriteStartElement("Test");
for (int j = 0; j < dt.Columns.Count; j++)
{
writer.WriteStartElement("c"+j);
string sss = dt.Rows[i][j].ToString();
writer.WriteValue(sss);
writer.WriteEndElement();
}
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteEndDocument();
}