1
我需要调用一个驻留在承载来自各种客户端的SQL Server的PC的外部DLL以获取数字签名。从SQLCLR获取字符串
我想用SQLCLR是一个很好的idea.I有问题,但...
我为了调用外部DLL函数的C#DLL内
[Microsoft.SqlServer.Server.SqlProcedure]
public static void Sign(SqlString receipt, out SqlString signature)
{
short result=0;
string arg = "";
string commPort = "1";
signature = "";
bool btrue = true, bfalse = false;
string CommPort = commPort.ToString();
string Receipt = receipt.ToString();
string Signature = signature.ToString();
ExtDll.Box ExtBox = new Box();
ExtBox.Sign_(ref CommPort,Receipt,ref result,ref Signature,ref bfalse,ref arg,ref btrue);
signature = (SqlString)Signature;
}
我写的asembly写了这为SQL Server
CREATE ASSEMBLY Mybox
FROM 'C:\Users\Panos\Documents\Visual Studio 2010\Projects\DigitalSignature\Extbox\bin\Debug\Extbox.dll'
WITH PERMISSION_SET = UNSAFE
我写了一个存储过程
CREATE PROC sp_extbox (@receipt char(2048), @signature char(100) out)
AS
EXTERNAL NAME Mybox.Signatures.Sign
但是,当我执行上面的脚本,我得到
CREATE PROCEDURE为“sp_extbox”失败,因为T-SQL和CLR类型参数“@receipt”不匹配。
它的工作! Thanx Tass! – PanosPlat