我在数据库中建过程
create proc pro_dishopeid(@ret int output)
as
begin
declare @max int
select @max=max(kc_id) from tb_kcxx
if @max is null
set @max=1
else
set @max=@max+1
end VB 中代码调用如下Private Sub Command1_Click()
Dim dicmd As New ADODB.command
With dicmd
.ActiveConnection = cn
.CommandType = adCmdStoredProc
.CommandText = "pro_dishopeid"
End With
Dim res As New ADODB.Parameter
With res
.direction = adParamOutput
.Type = adVarChar
.Size = 60
End With dicmd.Parameters.Append res
dicmd.Execute
Text1.Text = res.Value
End Sub但运行时报错 无效使用NULL 不知那地方错了, 各位大哥大姐快帮帮忙!
create proc pro_dishopeid(@ret int output)
as
begin
declare @max int
select @max=max(kc_id) from tb_kcxx
if @max is null
set @max=1
else
set @max=@max+1
end VB 中代码调用如下Private Sub Command1_Click()
Dim dicmd As New ADODB.command
With dicmd
.ActiveConnection = cn
.CommandType = adCmdStoredProc
.CommandText = "pro_dishopeid"
End With
Dim res As New ADODB.Parameter
With res
.direction = adParamOutput
.Type = adVarChar
.Size = 60
End With dicmd.Parameters.Append res
dicmd.Execute
Text1.Text = res.Value
End Sub但运行时报错 无效使用NULL 不知那地方错了, 各位大哥大姐快帮帮忙!
@ret参数没有用到,去掉即可