Friday, March 30, 2012

OLAP Connection in c#

Hello,

I'm trying to connect to my OLAP Cube with a c# project.

This is my code:

private void Page_Load(object sender, System.EventArgs e)

{

ADODB.ConnectionClass conn=new ConnectionClass();

conn.Open(ConfigurationSettings.AppSettings["connection_string"].ToString(),ConfigurationSettings.AppSettings["user_conn"].ToString(),ConfigurationSettings.AppSettings["password_conn"].ToString(),0);

try

{ADOMD.CellsetClass cs=new CellsetClass();

cs.ActiveConnection=conn;

string szMDX="";

szMDX += "SELECT ";

szMDX += "{[Measures].members} ON COLUMNS,";

szMDX += "[CAMPAGNE].[Dim CAMPAGNE].members ON ROWS";

szMDX += " FROM [My Roi]";

cs.Open(szMDX,conn); // here there is an error

}

I've receive this error message:

"Impossible to use this connexion to make this operation, the connexion is closed or invalid in this context".

Can you help me please, because I can't find the problem.

Thanks,

Have you tried changing the provider in the connection string to MSOLAP.1 or MSOLAP.2 and did you verify that either TRUSTED_CONNECTION=YES or INTEGRATED SECURITY=SSPI is included?

No comments:

Post a Comment