Using Excel VBA, I am trying to pull data out of something called "Hypercube". When I try to search for a solution, I get lots of results about latin sampling which is not what I'm looking for.
It has its own driver called "Hypercube" and I know the server name of the location and I have found code that can call a stored procedure from within the server, but I can't find any code that allows me to pass through just an SQL Query. Does anyone have any ideas?
The below is the code that appears to work for a Stored Procedure:
Private Sub Test_one()
Dim buffer As String
Dim dbConn As New ADODB.Connection
Dim adoInsertComm As ADODB.Command
Set adoInsertComm = New ADODB.Command
buffer = "Provider=MSDASQL.1;Password=xxxxxxx;Persist Security Info=True;User ID=xxxxxxx;DRIVER=HyperCube;Server=xxxxxx"
dbConn.Open buffer
adoInsertComm.ActiveConnection = dbConn
adoInsertComm.CommandType = adCmdStoredProc
adoInsertComm.CommandText = "SPName"
adoInsertComm.Execute
End Sub
What would I write if I wanted to input a SQL Query? I have tried this already (below), but when it gets to the "RS.Open SQL, Conn" step it says: "Method 'Open' of object '_Recordset' failed"
Private Sub Test_two()
Dim Conn As New ADODB.Connection
Dim RS As New ADODB.Recordset
Dim SQL As String
Conn.Open "Provider=MSDASQL.1;Password=xxxxxx;Persist Security Info=True;User ID=xxxxxx;DRIVER=HyperCube;Server=xxxxxx"
Conn.CommandTimeout = 900
SQL = "SELECT Folders.FolderId, Folders.DisplayName FROM Sys.Folders Folders"
RS.Open SQL, Conn
RS.Close
Set Conn = Nothing
Set RS = Nothing
End Sub