|
楼主 |
发表于 2020-8-12 10:15:01
|
显示全部楼层
//datagrid绑定显示
public void Testing()
{
string commandString = "select{[Measures].[ZHANGSHU],[Measures].[Money]} on columns,{[Area].[Area Name].&[白水],[Area].[Area Name].&[澄城],[Area].[Area Name].&[大荔],[Area].[Area Name].&[渭南],[Area].[Area Name].&[潼关],[Area].[Area Name].&[蒲城],[Area].[Area Name].&[华阴],[Area].[Area Name].&[华县],[Area].[Area Name].&[合阳],[Area].[Area Name].&[韩城],[Area].[Area Name].&[富平] } on rows from [test mdx]";
//string commandString = Session["UserTypePicture"].ToString();
string ss = "Data Source=LOCALHOST;Initial Catalog=TestMDX;Provider=msolap;";
AdomdConnection conn = new AdomdConnection(ss);
Microsoft.AnalysisServices.AdomdClient.AdomdDataAdapter adp = new Microsoft.AnalysisServices.AdomdClient.AdomdDataAdapter(commandString, conn);
DataSet ds = new DataSet();
adp.Fill(ds);
DataGrid1.DataSource = ds.Tables[0].DefaultView;
DataGrid1.DataBind();
} |
|