How to fix Microsoft.AnalysisServices.AdomdClient.AdomdConnectionException: ‘The connection string is not valid.’
This is a very common error that crops up when trying to use Microsoft’s AdomdConnection.
Assuming your connection string is valid (syntax can be viewed in Microsoft’s docs), and the Microsoft.AnalysisServices.AdomdClient
namespace is referenced in your project, the problem may be that you’re referencing theAdomdClient.dll
file from the wrong directory.
To check where the dll file is being referenced:
- In Visual Studio, go to Project > Add Reference… > Browse
- Find
Microsoft.AnalysisServices.AdomdClient.dll
and check its path.
If the path begins with C:\Program Files
, it’s likely the wrong dll file.
To update the file:
- In Visual Studio, go to Project > Add Reference… > Browse
- Click Browse… and navigate to
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.AnalysisServices.AdomdClient\v4.0_15.0.0.0))89845dcd8080cc91\Microsoft.AnalysisServices.AdomdClient.dll
Now, when running:
AdomdConnection conn = new AdomdConnection();
conn.ConnectionString = “Data Source=powerbi://api.powerbi.com/v1.0/myorg/Sales Work;UID=bi.sales@salesworkspace.com;PWD=Password123!;”;
conn.Open();
It should connect successfully.