string connectionstr = "Data Source=localhost;Initial Catalog=zlkDW ;";
AdomdConnection connection = new AdomdConnection(connectionstr);
connection.Open();
string cmdstr = "select{[dim机台].[机台号]} on columns, {[dim材料厚度].[厚度大类].members} on rows from [Zlk DW]";
AdomdCommand cmd = new AdomdCommand(cmdstr, connection);
CellSet cs = cmd.ExecuteCellSet();
DataTable dt = CellSetToTable(cs);
程序执行到 CellSet cs = cmd.ExecuteCellSet();就报错误。说无权访问数据库。我在分析服务的项目中就建立角色,添加了成员身份,在数据库中也配置了权限,IIs也设置了,但就是老报错啊,高手讲一下吧。
------解决方案--------------------------------------------------------
AdomdConnection conn = new AdomdConnection();
conn.ConnectionString = "provider=msolap ;Integrated Security =SSPI ;Data Source= localhost ;Catalog =[数据库名] ;";
conn.Open();
AdomdCommand comm = new AdomdCommand();
comm.Connection = conn;
string strMDX = "select from [cub名称] ";
comm.CommandText = strMDX;
CellSet cs = comm.ExecuteCellSet();