cannot find type in assembly.

I followed instruction in http://www.codeproject.com/Articles/19954/Execute-NET-Code-under-SQL-Server-2005

My dll is the following abbreviated..

Imports System
Imports System.IO Imports System.Text Imports System.Data.SqlTypes

Public Class CyDeC

<Microsoft.SqlServer.Server.SqlProcedure(Name:="Sproc_CyDec ")>
Public Function E(ByVal message As SqlStringAs SqlString

Returns (SqlString)

End Function

 It compiles fine

On Sql2012 I create Assembly MyAssemblyName AUTHORIZATION dbo from <somepath> WITH PERMISSION_SET = UNSAFEthen

Create Procedure test(@message nvarchar(200)) AS EXTERNAL MyAssemblyName.Cydec.E

I get the following error message...

Msg 6505, Level 16, State 2, Procedure MyAssemblyName, Line 1

Could not find Type 'CyDec' in assembly MyAssemblyName.Cydec.E

The account underwhich SQL runs has full rights on the folder where the dll resides.

The dll was compiled under .net 2.0

What should I be looking at

Thanks

T

January 28th, 2014 1:08pm

Visual Basic projects have the concept of default namespaces. The default namespace is the name of your project, IIRC, so if your project's name is MyProject, the class name would be "MyProject.CyDec"

So you can other use the 2-part class name, or find the default namespace of your project and clear it. If you use the 2-part class name, you must use brackets to separate the pieces of the EXTERNAL NAME specification. Also, in your case you overrode the name of the proc by using the Name property of the SqlProcedureAttribute class. So, if the name of your project is MyProject, the EXTERNAL NAME specification would be:

AS EXTERNAL NAME MyAssemblyName.[MyProject.CyDec].Sproc_CyDec

Hope this helps, Bob

Free Windows Admin Tool Kit Click here and download it now
January 28th, 2014 6:23pm

Can you try  Create Procedure test(@message nvarchar(200)) AS EXTERNAL NAME [MyAssemblyName].[StoredProcedures].E

January 28th, 2014 8:08pm

will try - when I get back in the office.

We saw two snowflakes in Georgia and the state is shutting down!!

thank you

Free Windows Admin Tool Kit Click here and download it now
January 28th, 2014 8:11pm

If you can register a CLR (Common Language Runtime) assembly successfully but can not create an external stored procedure referencing the registered CLR assembly and getting the following SQL Server 2005 error message:

Msg 6505, Level 16, State 1, Procedure myProcedure, Line 2
Could not find Type 'myCLRMethods' in assembly 'myCLRAssembly'.

You can solve your problem by using the class name of your assembly in the format[NamespaceName.ClassName]

------------------------------------

Mark this answer help  will other.

April 15th, 2015 2:26am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics