2

I have problem with executing query using SqlCommand, I'm using ExecuteScalar() method and passing open query to it:

 SELECT * FROM OpenQuery(MY_OLAP,
'WITH MEMBER [Measures].[Out] AS
''[Measures].[Hours]''
 SELECT NON EMPTY [Machine].[Stops].[All]
 ON ROWS, [Measures].[Out] ON COLUMNS FROM [Machines]')

and trying to execute query against linked OLAP server but only thing I get is object=null or empty result, but when I run same query in management studio it's returning correct values.

 SqlConnection cubeConnection = new SqlConnection(cubeConnectonString);
            using (SqlCommand cubeCmd = new SqlCommand(cubeQuery, cubeConnection))
            {
                cubeConnection.Open();
                var tmp = cubeCmd.ExecuteScalar();
                if (tmp==null) {
                    cuberesult = "0";
                }
                else tmp.ToString();

            }

I added linked OLAP server than I add linked server login with my domain user in order to have access to this cube, I login to server using standard authentication, but this doesn't help. Some one have idea what I'm missing.

EXEC sp_addlinkedserver
    @server='MY_OLAP',
    @srvproduct='', 
    @provider='MSOLAP', 
    @datasrc='MYSQLSERVER', 
    @catalog='CUBE' 
4

2 に答える 2

0

申し訳ありませんが、これは 32 ビットの SQL Server を使用している場合にのみ可能であると最近読みました。X64はありますか?可能であれば、それを書面で見つけようとします。

于 2012-11-15T23:37:04.870 に答える