views:

201

answers:

1

create asymmetric key asymmetrickey from executable file = 'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll'

Why can't I use the above to generate an asymmetric key from framework libraries (for installing in SQL server as references for CLR functions). It gives an error:

"An error occurred during the generation of the asymmetric key."

Without an asymmetric key the database needs to be set to trustworthy to add the assembly to the SQL Server (2005). I realise the framework libraries are not intended for use from SQL Server, but am curious as to why this doesn't work.

A: 

System.Windows.Forms is not allowed inside CLR functions.

http://blogs.msdn.com/tims/archive/2004/05/27/142798.aspx

http://msdn.microsoft.com/en-us/library/ms403279.aspx

Randolph Potter
From your second link - "Unsupported libraries can still be called from your managed stored procedures, triggers, user-defined functions, user-defined types, and user-defined aggregates.". The question was specifically why you can't generate an asymmetric key - System.Windows.Forms can be used inside CLR functions but is not recommended. Without an asymmetric key the database needs to be set to trustworthy. I was just curious as to why the asymmetric key wasn't being created.
Simon D
Ah ok - a misread of your question then. I won't edit my answer as your comment is sufficient clarification.
Randolph Potter