![Using ADOMD 1.png](images/Using_ADOMD_1.png)
This topic explains and demonstrates the WinPivotGrid™ data binding using ADOMD data Source/Provider.
Ensure that your application is created based on .Net Framework 4 , not .Net Framework 4 Client Profile that does not include System.Web.Extensions .
This topic contains the following sections:
The following screenshot is the preview of the result from ADOMD data binding example in this topic:
To complete the procedure you need the following:
ADOMD data provider requires a connection via ConnectionString property, in order to communicate with the data in the server.
The following table lists parameters that are necessary to establish a connection to the data in the server using the AdomdInitialSettings object. There are other optional parameters for authentication and security (not listed here). The binding code example below contains all these settings.
In addition to the connection string, mentioned above, you need to configure the following settings including the dimensions (rows, columns and measures) of the cube.
ADOMD data provider communicates with Microsoft SQL Server Analysis Services using XML for analysis protocol. The following code example demonstrates how to configure the pivot grid to communicate with the data using ADOMD.
This example uses the data from the Infragistics OLAP server.
In C#:
AdomdInitialSettings settings = new AdomdInitialSettings();
StringBuilder sb = new StringBuilder();
sb.Append("provider=MSOLAP.4;");
sb.Append("data source=http://sampledata.infragistics.com/olap/msmdpump.dll;");
sb.Append("catalog=\"Adventure Works DW Standard Edition\";");
sb.Append("cube=\"Adventure Works\";");
options.ConnectionString = sb.ToString();
settings.Catalog = "Adventure Works DW Standard Edition";
settings.Cube = "Adventure Works";
settings.Rows = "[Date].[Calendar]";
settings.Columns = "[Product].[Category] ";
settings.Measures = "[Measures].[Reseller Sales Amount]";
AdomdDataSource adomdDs = new AdomdDataSource(settings);
ultraPivotGrid1.DataSource = adomdDs;
In Visual Basic:
Dim settings As New AdomdInitialSettings()
Dim sb As New StringBuilder()
sb.Append("provider=MSOLAP.4;")
sb.Append("data source=http://sampledata.infragistics.com/olap/msmdpump.dll;")
sb.Append("catalog=""Adventure Works DW Standard Edition"";")
sb.Append("cube=""Adventure Works"";")
settings.ConnectionString = sb.ToString()
settings.Catalog = "Adventure Works DW Standard Edition"
settings.Cube = "Adventure Works"
settings.Rows = "[Date].[Calendar]"
settings.Columns = "[Product].[Category] "
settings.Measures = "[Measures].[Reseller Sales Amount]"
Dim adomdDs As New AdomdDataSource(settings)
ultraPivotGrid1.DataSource = adomdDs
Although a separate control, the data selector ( MdxDataSelector) is an essential mechanism for the WinPivotGrid control; binding the data selector to the same data source as the pivot grid. The WinPivotGrid displays the list of dimensions and measures that the user can interact with at runtime by adding them to the pivot grid.
The following code example demonstrates binding data selector to the same data source as the pivot grid, using the data source object illustrated in the previous examples.
In C#:
mdxDataSelector1.DataSource = xmlaDs;
In Visual Basic:
mdxDataSelector1.DataSource = xmlaDs
The following screenshot illustrates the pivot grid with data selector both bound to XMLA data source. The same approach applied to ADOMD data source.
The following topics provide additional information related to this topic.