Users can connect to a cube database through ConnectCube method. This method accepts two parameters: the name of the cube and the connection string to the installed SSAS.
The connection string must specify the Data Source, that is the Server name, and the Initial Catalog, that is the database name. The version of the Provider must also be specified if more than one Microsoft OLE DB provider for FlexPivot is installed. For instance, if the Provider is set to MSOLAP, the latest version of OLE DB for FlexPivot installed on your system is used.
The code given below illustrates an example of connecting to a cube.