Wednesday, May 16, 2012

Getting results from SQLCLR

I have the following issue: I must have a DLL accessed from various clients inside the LAN, that resides in a the PC that hosts the SQL Server.



I need to access this DLL from all the clients in order to have it return a legal-tax checksum.



I thought to create a CLR procedure that calls the DLL in the server and returns the checksum.



I followed some internet examples and created a simple HelloWorld app....



I created a DLL in C#



[SqlProcedure]
public static int HelloWorld(int h)
{
return h;
}


I created the assembly in SQL Server:



CREATE ASSEMBLY MyChecksum
from 'C:\Users\Panos\Documents\Visual Studio 2010\Projects\DigitalSignature\Algobox\bin\Debug\checksum.dll'
WITH PERMISSION_SET = UNSAFE


I created the procedure



CREATE PROC sp_mychecksum (@h int)
AS
EXTERNAL NAME MyAlgobox.Signatures.HelloWorld


The bottom line is that when I execute my procedure (exec sp_mychecksum

12
) I get only a message




Command(s) completed successfully




and not the 12



Any clues?





No comments:

Post a Comment