2011-09-25 156 views
0

我在VB.NET(.NET 3.5,SQLServer 2005)中创建CLR存储过程。该过程具有4个BYVal参数和4个BYRef参数。它编译并正确部署到SQL Server中,并创建一个存储过程。 然而,当我尝试运行它坚持传递的输出参数在SP,它提供了以下错误.NET CLR存储过程OUTPUT参数

我从SQL Server中运行它,如下

DECLARE @return_value INT, @outI INT, @outS为nvarchar(4000), @outD日期时间, @outB位

EXEC @return_value = [dbo].[ProofOfConcept] 
     @inI = 23, 
     @inS = N'john', 
     @inD = N'12/12/2009', 
     @inB = 1, 
     @outI = @outI OUTPUT, 
     @outS = @outS OUTPUT, 
     @outD = @outD OUTPUT, 
     @outB = @outB OUTPUT 

'TestProc' 失败,因为参数5不允许为空。

我VB.NET过程声明低于

Public Shared Sub TestProc(ByVal inI As Integer, ByVal inS As String, ByVal inD As DateTime, ByVal inB As Boolean, _ 
            ByRef outI As Integer, ByRef outS As String, ByRef outD As DateTime, ByRef outB As Boolean) 
+0

代码我想你忘记了错误消息粘贴。 – siride

+0

除了@siride评论,您如何调用存储过程也会有所帮助。 – casperOne

回答

2

使用Out()ByRef之前的属性如下

Imports System.Runtime.InteropServices 
… 
Public Shared Sub PriceSum (<Out()> ByRef value As SqlInt32) 
+0

谢谢Evpo解决了它 – josephj1989