public static void connect()
{
try
{
string connectionStringStaging = @"Data Source=<server_name>;Catalog=<catalog_name>;User ID=<user_name>;Password=<my_password>";
string commandText = @"SELECT NON EMPTY { [Measures].[# Opptys moved to Committed] } ON COLUMNS FROM [Model]
CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS";
AdomdConnection connection = new AdomdConnection(connectionStringStaging);
connection.Open();
AdomdCommand cmd = new AdomdCommand(commandText);
cmd.Connection = connection;
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
Console.WriteLine(reader[0]);
}
}
}
catch (AdomdConnectionException ex)
{
Console.WriteLine("Error : " + ex.ToString());
}
}
我正在使用上面的代码连接到服务器,然后我正在使用它进一步运行 MDX 查询。问题是我得到的错误 - “连接字符串无效”在行
connection.open();
我在连接字符串中使用的设置名称是否不正确?有人可以帮我弄清楚我的连接字符串有什么问题吗?