.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

Assembly calling in MDX

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :Sql Server


  Any one pls tell me when i calling the Assemblyname.Classname.Functionname in MDX query im getting the following error.

"Execution of the managed stored procedure DecryptionSql failed with the following error: Exception has been thrown by the target of an invocation.The requested operation requires a SqlClr context, which is only available when running in the Sql Server process.."

Pls do help me to solve this issue.

Thanks in advance..



View Complete Post

More Related Resource Links

Calling Assembly in SSAS


Hi Experts,

Im using

While using the below MDX query im facing the below error.


select security_new.StoredProcedures.security_enc(1) on 0 from EncryptedCube

Executing the query ...
Execution of the managed stored procedure security_enc failed with the following error: Microsoft::AnalysisServices::AdomdServer::AdomdException.
The System.Data.SqlTypes.SqlInt32 type cannot be converted to an MDX type.

Is calling a .net 4.0 assembly possible from .net 2.0


Hi guys,

Can anyone tell me if its possible for a site or application that is running against .net 2.0 to call an assembly that was compiled using the 4.0 framework?

I always thought that this was possible, however when I try and add the reference to Visual Studio, I get an error saying that its not happy with the difference in versions.

Can anyone advise if there is a way to make this work?

Many thanks to anyone who can help

Best Regards


Verification of Calling Assembly




i want to ensure that using a method like "Encrypt()" in Assembly "crypter.dll" only returns the correct results if called from authorized programs/assemblies.

In detail i want to set up the following:


main.dll --> main assembly written in c# .NET containing all main application code

crypter.dll --> cryptographic assembly written in visual c++ to provide special cryptographic routines


Now i want ensure that only main.dll can p/invoke the methods provided by crypter.dll. I know strong names but by my understanding how they work

is that it's only a check if crypter.dll is equal to that version/public token which is referenced in main.dll.


Can i do some reflection from c++ to verify the public token/strong name of the main.dll calling method "MyCrypt()" and supply wrong data if called from third party assembly "3rdparty.dll"?


please let me know if i missed some mechanisms that already exist to do such things.



Returning SQLXml from CLR assembly fails when calling using ADO.NET


Currently I am calling as CLR function that returns SqlXML. The XML is over 4000 characters long and every time I issue the command from ADO.NET it keeps failing with the following Exception


A .NET Framework error occurred during execution of user-defined routine or aggregate \"Library.GetContentTypes\": \r\nSystem.NullReferenceException: Object reference not set to an instance of an object.\r\nSystem.NullReferenceException: \r\n   at System.Data.SqlServer.Internal.CClrLobContext.HManagedContext()\r\n   at System.Data.SqlServer.Internal.ClrLevelContext.GetCurrentContextForLobAccess(CClrLobContext* pLobContext)\r\n   at System.Data.SqlServer.Internal.ClrLevelContext.GetXvarXmlStream(CXVariantBase* pxvarSource, XvarLOBStreamInitCode eCode, CClrLobContext* pLobContext)\r\n.

The ADO.Net procedure looks like this 



Database db = CreateConnection();
      DbCommand dbCommand = db.GetStoredProcCommand("[dbo].[Library.GetContentTypes]");
      SqlParameter rv = new SqlParameter("@returnvalue", SqlDbType.Xml);
      rv.Direction = ParameterDirection.ReturnValue;

Calling C# Assembly from SSIS Script Task


Hi All,


I am extracting very nasty file from our source. Before we used to run that file thru our C# sharp program and changed it to pipe delimited file. Then with then help of our in house ETL tool we load it to our staging table in SQL server.

Now  how to load that nastly file, then run C# sharp  and load into destination ( all in SSIS)?


Can we call that C-sharp program from SSIS?





Error: Encountered multiple versions of the same assembly with GUID...try pre-importing...TlbImp


Hi!  Can someone tell me how I can troubleshoot the following error: "Encountered multiple versions of the same assembly with GUID...try pre-importing one of these assemblies".

The website developed in VS 2010 (.Net 3.5). This error is only received on my workstation.  Another person developing the site does not experience this issue at all.  Also, not sure if this matters, but on my workstation the 'Assembly Information...' dialog contains no values even though the 'AssemblyInfo.vb' file does specify values for the title, desc, etc.  The GUID being referenced in the error is the main project of the three projects within the solution.

I tried looking through the GAC, but do not see any references to the projects or DLLs in the VS solution and am not sure what else/where to look.

If I delete the copy of the solution on my local machine and pull down a copy from source control (AnkhSVN) the solution will build with no error.  Once I make any changes, such as adding a new aspx file, then the error is received.

I can provide any additional information needed.

The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must



This is frustrating, and I don't know how to solve it.

I have a strange problem. I am adding a LinqDatasource object, and set the context:

        protected void LinqDataSource_ContextCreating(object sender, LinqDataSourceContextEventArgs e)
            e.ObjectInstance = new KaruselaDataContext(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

Then I get this error:
The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Linq, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.


On web.config I already have this:
<add assembly="System.Data.Linq, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

NOTE: The datacontext is in a different project (DLL proect) where I added a refernce to System.Data.Linq.

is there another way adding a refernce to a web project? or only though teh web.config?


MySql.Data assembly problem



I added refernece MySql.Data to my project. My web.config looks like that:

<?xml version="1.0"?>
                <add assembly="MySql.Data, Version=, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>

But when in ServerExplorer I try "Add Connection..." I can't find "MySql Database" in the "Choose Data Source" dialog box?

What the problem can be?

Registering controls of current assembly object reference NOT set error


Hi There,

I have created a simple ASP.net Web Application (2.0) and have added a web user control.

Now in my page I have added this control but I have registered like this,

<%@ Register Assembly="WebApplication1" Namespace="WebApplication1" TagPrefix="Custom" %>

Which means I want to access all the controls in my current Web Application project

Then I have added my user control like this,

<Custom:MyUserControl ID="MyUserControl1" runat="server" PublicProperty="Hello" />

Every thing is fine but when I execute the project, NO control on my user control gets "instantiated" and thus I receive error "Object Reference Not Set"

Note that My Control has,

1) Public property PublicProperty as String

2) 1 Label control

In Load Event Handler I am setting Text property of Label Control to PublicProperty. Here object reference NOT set error occurs (which means Label control is NOT initialized).

I don't want to register my control using Src, TagPrefix etc. Any ideas?


Calling webservice from the server


I have a sample web service and aspx file. I deployed them to an existing website that contains classic asp files.

web-service: --- using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; [WebService(Namespace = "http://localhost/MyWebServices/")] public class MembershipRegisWebService : System.Web.Services.WebService { public MembershipRegisWebService () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string HelloWorld() { return "Hello World."; } }

aspx.cs file: --- using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Services; public partial class CallWebService : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { MembershipRegisWebService mrWs = new MembershipRegisWebService(); Response.Write("Calling web service:" + mrWs.HelloWorld()); } }

It runs locally, but it shows an error when running it from the server:

Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the follow

Could not load file or assembly - Web Deployment Project



I have the following projects in a solution :

- A Web Application

- A Class Library

- A Web Deployment project

The Web Application compiles and run fine when I don't go through the Web Deployment Project. However when I try to use that, I get the following error:

Error 1 An error occurred creating the configuration section handler for hibernate-configuration: Could not load file or assembly 'NHibernate' or one of its dependencies. The system cannot find the file specified. (F:\Folke\Folke.csproj_deploy\Release\web.config line 4) 1 1 Folke.csproj_deploy

"An error occurred creating the configuration section handler for hibernate-configuration: Could not load file or assembly 'NHibernate' or one of its dependencies. The system cannot find the file specified. (F:\Folke\Folke.csproj_deploy\Release\web.config line 4)"

This is the beginning of my Web.config:


CLR Inside Out: Migrating an APTCA Assembly to the .NET Framework 4


The CLR security model in the Microsoft .NET Framework 4 has undergone some substantial changes, including the adoption of "Level2" transparency, similar to the Silverlight security model. Mike Rousos provides an in-depth explanation of how that will likely impact authors of AllowPartiallyTrustedCallers (APTCA) libraries.

Mike Rousos

MSDN Magazine March 2010

Test Run: Determining .NET Assembly and Method References


Before you can test any software system effectively, you must understand the system under test. If the system includes the Microsoft® . NET Framework, understanding the system under test includes understanding its assembly and method dependencies.

James McCaffrey

MSDN Magazine March 2006

Advanced Basics: Calling All Operators


This month I found an interesting question in my mailbag. It went something like this: "I am writing some code working with points and other drawing objects in Visual Basic® 2003, and I just want to add an offset to a point, effectively moving the point.

Ken Getz

MSDN Magazine December 2004

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend