Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 error when trying to create assembly

Author  Topic 

olevin
Starting Member

2 Posts

Posted - 2006-12-27 : 10:57:11
Hi,

I ran the following in the management studio:

CREATE ASSEMBLY MyCLRAssembly from 'c:\temp\MyCLRAssembly.dll'
WITH PERMISSION_SET = SAFE
Go

For some reason I get the following error:

Msg 6517, Level 16, State 1, Line 1
Failed to create AppDomain 'AdventureWorks.dbo[ddl].22'.

I tried to google this error, but couldn't find it...
I would appreciate it if someone can tell me what I'm doing wrong.

Ohad.

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-12-27 : 11:07:37
What is the namespace and name of your class? Go ahead and post the full declaration from your .NET code.
Go to Top of Page

olevin
Starting Member

2 Posts

Posted - 2006-12-27 : 11:17:25
Actually I tried it with a sample code I found after I got the same error with MS "HelloWorld" example. Here is the vb code for this class:

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

Public Class MyFirstCLRProcs
<Microsoft.SqlServer.Server.SqlProcedure()> _
Public Shared Sub CLRProcs(ByVal iActionID As Integer)

SqlContext.Pipe.Send("Hello world! It's now " & System.DateTime.Now.ToString())
Using oConnection As New SqlConnection("context connection=true")
Try
oConnection.Open()
Dim oCommand As New SqlCommand( _
"select top 10 EventID ,StatusKey, ProcessTime, UserType, ActionID" & _
" from EventTable where ActionID = " & _
iActionID, oConnection)
Dim oReader As SqlDataReader
oReader = oCommand.ExecuteReader()
SqlContext.Pipe.Send(oReader)
Catch ex As Exception
SqlContext.Pipe.Send(ex.ToString())
End Try
End Using
End Sub
End Class
Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-12-27 : 11:45:20
Sounds like it could be a security problem - have you modified the code access security policy on your computer at all? Take a look in the Windows Event Log and see if there are any messages there that give more info.
Go to Top of Page
   

- Advertisement -