Saturday, March 10, 2012

What is ADOMD.NET

In simple, ADOMD.NET is an extension of ADO.NET. ADOMD.NET is a Microsoft .NET Framework data provider that is designed to communicate with Microsoft SQL Server Analysis Services. Using this extension we can read multidimensional schema, query cubes, and retrieve the results. ADOMD.NET commands or queries can be sent in Multidimensional Expressions (MDX), Data Mining Extensions (DMX), Analysis Services Scripting Language (ASSL), or even a limited syntax of SQL, and the command may or may not return a result.

The ADOMD.NET data provider is represented by the Microsoft.AnalysisServices.AdomdClient namespace which is included in the Microsoft.AnalysisServices.AdomdClient.dll located in,
"C:\Program Files\Microsoft.NET\ADOMD.NET\100."
Sample Connection
string conString = "Data Source=RAVANA;Initial Catalog=AdvWorks";
string query = "your MDX/DMX etc query";
AdomdConnection oAdomdConnection = new AdomdConnection(conString);
oAdomdConnection.Open();
AdomdCommand oAdomdCommand = new AdomdCommand(query, oAdomdConnection);
AdomdDataReader oAdomdDataReader = oAdomdCommand.ExecuteReader();
while (oAdomdDataReader.Read())
{
      //reading values
}
oAdomdDataReader.Close();
oAdomdConnection.Close();

The AdomdConnection class represents a connection to a multidimensional data source. The AdomdDataReader class retrieves a forward-only, read-only stream of data from a data source and is similar to other data reader classes in ADO.NET. The Read( ) method of the AdomdDataReader object advances to the next row and retrieves the results.

Happy Coding.

Regards,
Jaliya