'xxxx' 失败,因为不允许参数 1 为空值并且该参数不是输出参数。
在sql server 的存储过程调用时发生的错误,
解决也很容易,就是给要传递的参数赋个值,
可是我的问题是,这个参数我本来就是用来作output的,因为不赋值也应该能用啊,
为什么会是这种提示.存储过程的代码(用了sql server 2005 clr)
 <Microsoft.SqlServer.Server.SqlProcedure()> _
      Public Shared Sub ttt1(ByRef count As Integer)
        Dim cn As New SqlConnection
        cn.ConnectionString = "context connection=true"
        Dim cmd As New SqlCommand()
        cmd = cn.CreateCommand
        cmd.CommandText = "select  @a1=count(序号) from 收报办理 where 接收者id=3 and not 状态='已办'"
        cmd.Parameters.Add("@a1", SqlDbType.Int)
        cmd.Parameters("@a1").Direction = ParameterDirection.Output
        cn.Open()
        cmd.ExecuteScalar()
        count = cmd.Parameters("@a1").Value
    End Sub在sql server的查询分析器中的代码
use [kgsys]
declare @a2 int
''''''''这里加一条set @a2=xxx就正常,可是不加不行吗?
exec ttt1 @a2 output
print @a2