dbTalk Databases Forums  

VB Script and MDX

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss VB Script and MDX in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kalyan
 
Posts: n/a

Default VB Script and MDX - 03-13-2006 , 12:01 PM






Does any body have sample code to execute MDX query using VB script,


Please share with me,


Thanks
Kalyan

Reply With Quote
  #2  
Old   
Joerg
 
Posts: n/a

Default RE: VB Script and MDX - 03-13-2006 , 02:17 PM






Hello Kalyan,

HTH
Jörg

'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************

Function Main()

set conn = CreateObject("ADODB.CONNECTION")
set cset = CreateObject("ADOMD.CELLSET")

conn.open "Provider=MSOLAP.2;Data Source=localhost;Initial Catalog=Foodmart
2000"
cset.open "select {measures.[store sales]} on 0 ,[Gender].members on 1 from
sales",conn

for i = 0 to cset.axes(1).positions.count -1
msgbox cset.axes(1).positions(i).members(0).caption & ":" &
cset(0,i).FormattedValue
next

cset.close : set cset = nothing
conn.close : set conn = nothing
Main = DTSTaskExecResult_Success

End Function


"Kalyan" wrote:

Quote:
Does any body have sample code to execute MDX query using VB script,


Please share with me,


Thanks
Kalyan

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.