キューブがあり、次のコードを使用してデータを取得しようとしています。クエリが返す列と行の数がわかりません。各行にまたがる各列の値を読みたいだけです。
void OutputDataWithXML()
{
//Open a connection to the local server.
AdomdConnection conn = new AdomdConnection("Data Source=localhost");
conn.Open();
//Create a command to retrieve the data.
AdomdCommand cmd = new AdomdCommand(@"WITH MEMBER [Measures].[FreightCostPerOrder] AS
[Measures].[Reseller Freight Cost]/[Measures].[Reseller Order Quantity],
FORMAT_STRING = 'Currency'
SELECT [Geography].[Geography].[Country].&[United States].Children ON ROWS,
[Date].[Calendar].[Calendar Year] ON COLUMNS
FROM [Adventure Works]
WHERE [Measures].[FreightCostPerOrder]", conn);
//Execute the command, retrieving an XmlReader.
System.Xml.XmlReader reader = cmd.ExecuteXmlReader();
**// How to get the values form each column here ????
// I just want to read value of each column going over each row**
Console.WriteLine(reader.ReadOuterXml());
//Close the reader, then the connection
reader.Close();
conn.Close();
//Await user input.
Console.ReadLine();
}
次のリンクは、SSAS キューブからデータを取得する最速の方法は XMLReader であると述べています
http://msdn.microsoft.com/en-us/library/ms123479(v=sql.105).aspx