Analysis Services Programming
Processing a Local Cube
The final step in creating a local cube includes creating a Connection object from Microsoft® ActiveX® Data Objects (ADO) and opening the data source connection with the ADO Open method. This causes PivotTable® Service to create the local cube and populate it with data.
The code in this topic includes the Connection object and Open method. This code also completes the creation of the local cube (.cub) file example provided in previous topics.
Examples
A. Connecting to the Data Source
The following code shows how to process a local cube:
'*-----------------------------------------------------
'* Set a new ADO DB Connection object.
'* Create the cube by passing concatenated connection
'* string to Open method of the connection object.
'*-----------------------------------------------------
Set cnCube = New ADODB.Connection
s = strProvider & ";" & strDataSource & ";" & strSourceDSN & ";" & strCreateCube & ";" & strInsertInto & ";"
Screen.MousePointer = vbHourglass
cnCube.Open s
Screen.MousePointer = vbDefault
Exit Sub
Error_cmdCreateCubeFromDatabase:
Screen.MousePointer = vbDefault
On Error Resume Next
' Get the ADO errors.
Dim erCur as Error
Dim sErrDesc as String
If cnCube.Errors.Count > 0 Then
For Each erCur In cnCube.Errors
sErrDesc = sErrDesc & erCur.Source & ": " & erCur.Description & vbCrLf
Next erCur
End If
MsgBox Err.Description & sErrDesc