Home All Groups Group Topic Archive Search About

Could not find Type 'StoredProcedures' in assembly 'HelloWorld'

Author
19 Aug 2006 6:54 PM
carl.jung
Hi,

I am trying to create a CLR stored Procedure as bellow:

create procedure HelloWorldSP
as
external name Helloworld.StoredProcedures.HelloWorldStoredProcedure1

However I get the error:
Could not find Type 'StoredProcedures' in assembly 'HelloWorld'

My .NET code to create the managed code is:

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server


Partial Public Class StoredProcedures
    Public Shared Sub HelloWorldStoredProcedure1()
        ' Add your code here
        SqlContext.Pipe.Send("Hello World")
    End Sub
End Class

Any suggestions are very much appreciated.

Thanks,

Carly

Author
19 Aug 2006 7:26 PM
Hari Prasad
Hi,

I am not good in CLR; but while searching I got a step by step method which
seems to be work out well. Take a look into this.

http://www.sqldbatips.com/showarticle.asp?ID=22

Thanks
Hari
SQL Server MVP

<carl.j***@hotmail.com> wrote in message
Show quote
news:1156013687.595727.318950@i42g2000cwa.googlegroups.com...
> Hi,
>
> I am trying to create a CLR stored Procedure as bellow:
>
> create procedure HelloWorldSP
> as
> external name Helloworld.StoredProcedures.HelloWorldStoredProcedure1
>
> However I get the error:
> Could not find Type 'StoredProcedures' in assembly 'HelloWorld'
>
> My .NET code to create the managed code is:
>
> Imports System
> Imports System.Data
> Imports System.Data.SqlClient
> Imports System.Data.SqlTypes
> Imports Microsoft.SqlServer.Server
>
>
> Partial Public Class StoredProcedures
>    Public Shared Sub HelloWorldStoredProcedure1()
>        ' Add your code here
>        SqlContext.Pipe.Send("Hello World")
>    End Sub
> End Class
>
> Any suggestions are very much appreciated.
>
> Thanks,
>
> Carly
>
Author
19 Aug 2006 11:05 PM
Erland Sommarskog
(carl.j***@hotmail.com) writes:
> However I get the error:
> Could not find Type 'StoredProcedures' in assembly 'HelloWorld'
>
> My .NET code to create the managed code is:
>
> Imports System
> Imports System.Data
> Imports System.Data.SqlClient
> Imports System.Data.SqlTypes
> Imports Microsoft.SqlServer.Server
>
>
> Partial Public Class StoredProcedures

You need a

   <Microsoft.SqlServer.Server.SqlProcedure>

here.

>     Public Shared Sub HelloWorldStoredProcedure1()
>         ' Add your code here
>         SqlContext.Pipe.Send("Hello World")
>     End Sub
> End Class
>
> Any suggestions are very much appreciated.

Also look at section
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/denet9/html/bbdd51b2-a9b4-4916-ba6f-7957ac6c3f33.htm
in Books Online.

--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Author
21 Aug 2006 7:41 PM
carl.jung
Hello everyone,

Thank you for your quick replies.
My situation is still not solved....
I still get the same error, however when I compile my vb code using the
command-line compiler vbc everything is OK.
I think somebody else in this news group had the same problem so I am
going to search for it.
Any ideas are very much appreciated.

Thanks,

Carly
Erland Sommarskog wrote:
Show quote
> (carl.j***@hotmail.com) writes:
> > However I get the error:
> > Could not find Type 'StoredProcedures' in assembly 'HelloWorld'
> >
> > My .NET code to create the managed code is:
> >
> > Imports System
> > Imports System.Data
> > Imports System.Data.SqlClient
> > Imports System.Data.SqlTypes
> > Imports Microsoft.SqlServer.Server
> >
> >
> > Partial Public Class StoredProcedures
>
> You need a
>
>    <Microsoft.SqlServer.Server.SqlProcedure>
>
> here.
>
> >     Public Shared Sub HelloWorldStoredProcedure1()
> >         ' Add your code here
> >         SqlContext.Pipe.Send("Hello World")
> >     End Sub
> > End Class
> >
> > Any suggestions are very much appreciated.
>
> Also look at section
> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/denet9/html/bbdd51b2-a9b4-4916-ba6f-7957ac6c3f33.htm
> in Books Online.
>
> --
> Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se
>
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Author
21 Aug 2006 10:46 PM
Erland Sommarskog
(carl.j***@hotmail.com) writes:
> Thank you for your quick replies.
> My situation is still not solved....
> I still get the same error, however when I compile my vb code using the
> command-line compiler vbc everything is OK.

Great! Stick to the command-line compiler. That's what I do. Visual
Studio is just confusing. I read a description in Itzik Ben-Gan's
"Inside SQL Server: T-SQL Querying" on how to deploy a user-defined
aggregate through Visual Studio. 19 steps! 19! Let's see

  1) Compile with vbc/csc
  2) Copy DLL to the SQL Server box, if it's not local.
  3) CREATE ASSEMBLY
  4) CREATE AGGREGATE (or whatever)

Boy, I'm not paying for Visual Studio to get 15 more steps.

--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Author
22 Aug 2006 9:49 PM
Hugo Kornelis
On Mon, 21 Aug 2006 22:46:42 +0000 (UTC), Erland Sommarskog wrote:

> (carl.j***@hotmail.com) writes:
>> Thank you for your quick replies.
>> My situation is still not solved....
>> I still get the same error, however when I compile my vb code using the
>> command-line compiler vbc everything is OK.
>
>Great! Stick to the command-line compiler. That's what I do. Visual
>Studio is just confusing. I read a description in Itzik Ben-Gan's
>"Inside SQL Server: T-SQL Querying" on how to deploy a user-defined
>aggregate through Visual Studio. 19 steps! 19!

Hi Erland,

I must admit that Itzik's books are still in my "to-be-read" stack (they
are on top, though), but when I've been playing around with CLR, I used
a single step: Click menu item "Build" / "Deploy".

Which 18 steps have I missed?

--
Hugo Kornelis, SQL Server MVP
Author
22 Aug 2006 10:42 PM
Erland Sommarskog
Hugo Kornelis (h***@perFact.REMOVETHIS.info.INVALID) writes:
> I must admit that Itzik's books are still in my "to-be-read" stack (they
> are on top, though), but when I've been playing around with CLR, I used
> a single step: Click menu item "Build" / "Deploy".
>
> Which 18 steps have I missed?

I don't know. I skipped that part. It was just too much. But I don't
believe it was one step. I once had a small C# program I wanted to
compile, and I figured that Visual Studio was the place to go. I had
to give up, and I still don't know how to do it VS. Command-line is
so much easier.


--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

AddThis Social Bookmark Button