locked
Can I write MDX query within Sqldatasource Control ? RRS feed

  • Question

  • User-775831949 posted

    I am new to MDX...

    I already have a working sqldatasource and there is a selectcommand within the control. It is working fine.
    The data source file is an OLAP cube I created elsewhere and copied to this web server (so maybe this is called offline/local cube file?) and thus I am wondering where I can put my MDX statement. Can I just write that MDX query in selectcommand WITHIN the sqldatasource control ?

    Pls help, thanks

    Thursday, September 29, 2011 8:52 PM

Answers

  • User-394472208 posted

    Hi,

    You can create linked server also in SQL Express. But Analysis Services is not available with SQL Express.

    I am not exactly sure what you mean with cube file, but if it is a local cube than you can use it with linked server connection too (with the limitation of local cubes).
    Local Cubes (Analysis Services - Multidimensional Data)
    http://msdn.microsoft.com/en-us/library/bb522640.aspx

    Regards,
    Orsi
    Microsoft Online Community Support

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 19, 2011 4:53 AM

All replies

  • User3866881 posted

    Can I just write that MDX query in selectcommand WITHIN the sqldatasource control ? What is the easier way of doing MDX and where is the best place to put it into work ?

    A better way on my point is that you can first write a stored procedure with MDX statements, and then refer to this stored procedure with the help of your statement.

    Thx again

    Saturday, October 1, 2011 8:34 PM
  • User-775831949 posted

    Thanks, but I still wish to explore if we can successfully write MDX in selectcommand property of the sqldatasource control... anyone can help to try ?

     

    Thanks

    Monday, October 3, 2011 1:44 AM
  • User-394472208 posted

    Hi

    In TSQL you can access SSAS data through linked server and OPENQUERY
    You have to setup a linked server to SSAS.
    Then you can run OPENQUERY with the MDX like this:
    SELECT * FROM OPENQUERY (SSASLinkedServer, ‘MDX Query text’)

    HTH,
    Orsi
    Microsoft Online Community Support

    Monday, October 10, 2011 12:28 PM
  • User-775831949 posted

    Thanks a lot. Actually I do not have full SQL server. I just have SQL express + Ms Access.

    So I want to explore if I have a sqldatasource control (Drag and drop from toolbox) that is already succesfully connected to a cub file and successfully run SQL command by writing SQL in Selectcommand property and the related Gridview can display desired data...

    I just now want to take a bit step further: in the Selectcommand property of sqldatasource control on the page can we write MDX and that's all I wish to know.

    Can I say the answer is NO ?

    Thanks to all.

    Monday, October 10, 2011 9:13 PM
  • User-394472208 posted

    Hi,

    You can create linked server also in SQL Express. But Analysis Services is not available with SQL Express.

    I am not exactly sure what you mean with cube file, but if it is a local cube than you can use it with linked server connection too (with the limitation of local cubes).
    Local Cubes (Analysis Services - Multidimensional Data)
    http://msdn.microsoft.com/en-us/library/bb522640.aspx

    Regards,
    Orsi
    Microsoft Online Community Support

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 19, 2011 4:53 AM
  • User-775831949 posted

    Actually I do not have SQL Server on the web server and the cub file is a standalone cub file that I created on another machine and copied to here. But I can use standard SQL command to query it with good result within the sqldatasource control on aspx page.

    In this environment, how can I write MDX on this query ?
    If SQL server is a must, after I installed SQL Server Express, how to sets up linked server connection ? I do not know how to do it... any documentation ?

    thanks

    Thursday, October 20, 2011 9:38 PM
  • User-394472208 posted

    Hi,

    Normally I would suggest to write the MDX query first in Management Studio MDX query editor and then copy the finished query to the OPENQUERY. But in the described environment you don’t seem to have many tools available. Couldn’t you write the query on the server where you created the cub file? Management Studio should be available there.

    How to write MDX is a big topic, you will find several books about it. Here a couple of links for starting on MDX:
    MDX Query Fundamentals (MDX)
    http://msdn.microsoft.com/en-us/library/ms145514.aspx
    The Basic MDX Query (MDX)
    http://msdn.microsoft.com/en-us/library/ms144785.aspx

    You can find the description how to create linked server in Management Studio or TSQL here:
    Creating Linked Servers (SQL Server Database Engine)
    http://msdn.microsoft.com/en-us/library/ff772782.aspx

    HTH,
    Orsi

    Thursday, October 27, 2011 10:31 AM