CLR将数据表传递给过程 [英] CLR Pass DataTable To Procedure
本文介绍了CLR将数据表传递给过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有SQL CLR项目;具有类StoredProcedures
Hi,
I have SQL CLR project; has class StoredProcedures
public partial class StoredProcedures
{
[Microsoft.SqlServer.Server.SqlProcedure()]
public static void USPIsAccountFunbAllowOverDraft(DataTable debits, DataTable credits, out SqlInt32 status)
{.....}}
我创建了程序集
I Created assembly
CREATE ASSEMBLY Accounting_SQL_CLR
FROM 'D:\Moustafa\Projects\SQLCLR\bin\Debug\SQLCLR.dll'
WITH PERMISSION_SET = EXTERNAL_ACCESS;
GO
我尝试创建过程,但是失败了
I try to create procedure, but it was faild
CREATE PROC USP_Is_Account_Funb_Allow_Over_Draft
(
@Debits AS Account_Type READONLY
,@Credits AS Account_Type READONLY
,@Status INT OUT
)
AS
EXTERNAL NAME Accounting_SQL_CLR.StoredProcedures.USPIsAccountFunbAllowOverDraft
GO
错误消息:
Error Message:
Msg 6552, Level 16, State 3, Procedure USP_Is_Account_Funb_Allow_Over_Draft, Line 1
CREATE PROCEDURE for "USP_Is_Account_Funb_Allow_Over_Draft" failed because T-SQL and CLR types for parameter "@Debits" do not match.
注意:Account_Type是表的类型
Note: Account_Type is Type As Table
推荐答案
您不能将数据表直接传递到存储过程.相反,您应该定义一个类型并使用它.即使参数的传递是相反的,请查看 ^ ]
You can''t pass a data table directly to the stored procedure. Instead you should define a type and use it. Even though the passing of the parameters is other way round, have a look at How to pass multiple records to a Stored Procedure[^]
这篇关于CLR将数据表传递给过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文