asp如何用通过Web访问OLAP数据?
时间:2010-06-16 09:52:00
如何用通过Web访问OLAP数据?
<%
Set Conn=Server.CreateObject(″ADODB.Connection″)
Conn.Open ″Data source=Alexander;Provider=MSOLAP;″
Conn.DefaultDatabase = ″FoodMart″ : Set Cst=Server.CreateObject (″ADOMD.Cellset″)
Cst.Source = strMDX : Set Cst.ActiveConnection = Conn : Cst.Open
′执行MDX
Set Axs = Cst.Axes(1) : Rows = Axs.Positions.Count - 1
Cols = Cst.Axes(0).Positions.Count - 1 : Response.Write ″〈TABLE BORDER=1〉″
Response.Write ″〈TR〉〈TD〉〈/TD〉″
For j = 0 To Cols
Response.Write ″〈TD〉″+Cst.Axes(0).Positions(j).Members(0).Caption +″〈/TD〉″
Next : Response.Write ″〈/TR〉″
For i = 0 To Rows
Response.Write ″〈TR〉〈TD〉″+Axs.Positions(i).Members(0).Caption +″〈/TD〉″
For j=0 To Cols
Response.Write ″〈TD〉″+Cst(j, i).FormattedValue+″〈/TD〉″
Next
Next : Response.Write ″〈/TABLE〉″ : Cst.Close : Conn.Close
%>