Showing posts with label registered. Show all posts
Showing posts with label registered. Show all posts

Thursday, March 22, 2012

Custom Stored procedure

Hi, I've tried to develop custom function for AS 2005, written in C#, and registered as database assembly

Code snippet is here

public string MySampleMethod()

{

AdomdCommand command = new AdomdCommand();

command.CommandText = string.Format("with member A AS 'username' select A on 0 FROM MyCube");

return (string)command.ExecuteScalar();

}

Error that I've got was "XML for Analysis parser: The input query is not in the language specified in the Dialect property for this request."

When I execute the same query from SQL Management Studio, everything works OK.

What I did wrong and how it can be resolved?

Thanks in advance

Borko

Hi Borko,

You can't use AS stored procs to execute queries on the same connection as you're using to call the proc, unfortunately. You can open a new connection within the proc but that may or may not be particularly useful to you - here's an example of how to do this:

using System;

using System.Collections.Generic;

using System.Text;

using Microsoft.AnalysisServices.AdomdServer;

using Microsoft.AnalysisServices.AdomdClient;

namespace MDXTests

{

public class RunMDXQueries

{

public static Microsoft.AnalysisServices.AdomdClient.AdomdDataReader RunAQuery()

{

Microsoft.AnalysisServices.AdomdClient.AdomdCommand c = new Microsoft.AnalysisServices.AdomdClient.AdomdCommand("select measures.members on 0 from [adventure works]");

AdomdConnection conn = new AdomdConnection(@."Data Source=localhost\sh; Provider=msolap.3; initial catalog=adventure works dw");

conn.Open();

c.Connection = conn;

return c.ExecuteReader();

}

}

}

You need to set security permissions to 'unrestricted' to get this to work; you can then call this from SQLMS using the following:

CALL SPSRUNNINGQUERIES.RUNAQUERY()

HTH,

Chris

|||

Chris,

information that is not possible to execute queries on the same connection as connection used to call the proc is very usefull.

Thank you very much.

Borko

Sunday, February 19, 2012

Custom Assembly Problems

Hi All,
I am having a problem with a shared assembly I created. I created a
dll and registered it in the GAC of my development machine. Then I
added a new key into my system registry so I could add it into a
project easily when in Visual Studio. It works well when I reference
it in my ASP.NET/VB.NET applications.
In reporting services, I added the reference to the dll in my report
just fine. I call a function in the custom report code, which
references my dll. The function returns a boolean which, within an
"IIf" statement, determines the background color of certain cells. It
does the job, builds without errors or warnings, and previews in
Visual Studio just the way it should. However, after deploying to my
production server, it seems like it is basically ignoring my call to
the shared assembly. I get no errors or warnings, but the background
color of the mentioned cells never gets set.
Is there another reference I am missing? Any other suggestions?
Thanks in advance!Some basic stuff which you may have already tried
1. Extend your assembly code to output a "hello world" string. Do this
by using a variable , setting its value through a parameter and use
error handling to output any errors , instead of the parameter string,
in case of errors.
2. Create a blank report and use the function call to display the
string in a text box
3. Deploy your assembly to the production GAC
4. Deploy your report to the production GAC
If that works , use the same function call to perform bits of your
original code and return a "done" string or the error string after the
function is completed .
That should help you in finding out where you are getting issues.
Best of luck
Cheers
Shai|||How do you deploy a report to the GAC?|||On Nov 30, 6:48 am, John <john.n.b...@.gmail.com> wrote:
> How do you deploy a report to the GAC?
Sorry , thats was a typo. I meant deploy the report to production
environment
Cheers
Shai