“Microsoft.DataWarehouse.Interfaces, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91”的引用
通过VS访问Cube中的数据挖掘模型,注意程序集的引用。
错误 1 类型“Microsoft.DataWarehouse.Interfaces.IMiningModelViewerControl2”在未被引用的程序集中定义。必须添加对程序集“Microsoft.DataWarehouse.Interfaces, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91”的引用。 D:\My Documents\C# Programming\WindowsApplication3\WindowsApplication3\Form1.Designer.cs 65 63 WindowsApplication3
解决办法:把D:\Program Files\Microsoft SQL Server\90\SDK\Assemblies\Microsoft.DataWarehouse.Interfaces.dll
拷贝到D:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.DataWarehouse.Interfaces.dll
后台完整代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.AnalysisServices.Viewers;
using Microsoft.DataWarehouse.Interfaces;
namespace WindowsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.treeViewer1.ConnectionString = "Provider=MSOLAP.3;Data Source=sxf;Integrated Security=SSPI;Initial Catalog=Adventure Works DW;";
this.treeViewer1.MiningModelName = "TM Decision Tree";
this.treeViewer1.LoadViewerData(string.Empty);
}
}
}
结果如图