MethodsetConnection
DescriptionSets a new connection for the OLAP control.
Return type
True (-1)The connection was used successfully.
False(0)The connection can't be used or an error occurred.
Parameters
m_cnConnectionAn ADODB.Connection that the control will use.
errStringReturns the error string if one occurred.
ExamplesDim cn As New ADODB.Connection
Dim errString As String
Call cn.Open("Provider=MSOLAP;Data Source=C:\Dev\OlapX\SEV.cub;Client Cache Size=25;Auto Synch Period=10000")
With OlapXApp1
 .OpenFile = "C:\OLAP_CUBES_DIR\SEV.cub"
 .OpenServer = ""
 Call .setConnection(cn, errString)
 If errString <> "" Then
  Call MsgBox(errString)
 End If
End With
ExplanationShares a connection between a local cube file and a host application.
ExamplesDim cn As New ADODB.Connection
Dim errString As String
Call cn.Open("Provider=MSOLAP.2;Data Source=localhost;Client Cache Size=25;Auto Synch Period=10000;Initial Catalog=FoodMart 2000")
With OlapXApp1
 .OpenServer = "localhost"
 .OpenDB = "FoodMart 2000"
 .OpenCube = "Sales"
 Call .setConnection(cn, errString)
 If errString <> "" Then
  Call MsgBox(errString)
 End If
End With
ExplanationShares a connection to MS Analysis Services between the control and a host application.
See also
OpenServerOpen a cube located in MS Analysis Services
OpenFileOpen a local cube file
OpenViewOpen a local cube view
OpenWWWDirOpen a cube file or cube view located on a web server
NotesIf there is a connection already, the current connection is closed and opened with the new connection specified here.
Use the Open... properties to specified which cube the control will connect.
For MS Analysis Services, you must specify an Initial catalog to connect to a database.