Delphi如何取到MS Analysis Servers共享维度的数据(同浏览维度数据)(200分)

  • 主题发起人 主题发起人 yousoft
  • 开始时间 开始时间
Y

yousoft

Unregistered / Unconfirmed
GUEST, unregistred user!
Dim cn As ADODB.Connection
Dim ct As ADOMD.Catalog
Dim cb As ADOMD.CubeDef
Dim dm As ADOMD.Dimension
Dim hr As ADOMD.Hierarchy
Dim lv As ADOMD.Level
Dim mb As ADOMD.Member
Dim pr As ADODB.Property

Set cn = New ADODB.Connection
cn.Open "provider=msolap;data source=c:/warecube.cub"

Set ct = New ADOMD.Catalog
Set ct.ActiveConnection = cn

Set cb = ct.CubeDefs(0)
Set dm = cb.Dimensions("Product")
Set hr = dm.Hierarchies(0)
Set lv = hr.Levels("Product Name")

For Each mb In lv.Members
Debug.Print mb.Name
Debug.Print "----------------"
For Each pr In mb.Properties
Debug.Print pr.Name & ": " & pr.Value
Next pr
Debug.Print
Next mb


其中ADOMD.CubeDef、ADOMD.Dimension ADOMD.Hierarchy ADOMD.Level、ADOMD.Member
在我引入ADOMD后都不能用,在VB中可以。怎么回事??
 
已经搞定,但提出数据后用Delphi自带的Decision Cube显示数据不完整,总会比实际的数据少N多条??为何?谁知道有没有更好用Decision Cube??????
 
还真不知道,关注一下。[:D]
 
var
Catalog1: ICatalog;
cbCur:CubeDef25;
dmCur:Dimension;
hrCur:Hierarchy;
lvCur:Level;
mbCur:Member;
i,n,m,n1,n2,n3:integer;
begin
Catalog1 := CoCatalog.Create;
Catalog1.Set_ActiveConnection(ADOConn.ConnectionString);
for i:=1 to catalog1.CubeDefs.Count-1 do
begin
cbCur:=catalog1.CubeDefs.Item;
showmessage(cbcur.Name);
for n:=0 to cbcur.Dimensions.Count-1 do
begin
dmCur:=cbcur.Dimensions.Item[n];
// showmessage(dmcur.Name);
for m:=0 to dmcur.Hierarchies.Count-1 do
begin
hrCur:=dmcur.Hierarchies.Item[m];
for n1:=0 to hrcur.Levels.Count-1 do
begin
lvCur:=hrcur.Levels.Item[n1];
for n2:=0 to lvCur.Members.Count-1 do
begin
mbCur:=lvCur.Members.Item[n2];
showmessage(inttostr(mbcur.LevelDepth)+' '+mbcur.Name);
end;
end;
end;
end;
end;
//cbCur:=Catalog1.

end;


问题解决了,送分了!!!
 
接受答案了.
 
后退
顶部