表结构如下:
IC码 IC卡状态
ICNUM ICStatus
存储过程,如下:
CREATE PROCEDURE GetIcStatus
@ICNUM CHAR(10)
AS
BEGIN
SELECT ICSTATUS FROM TB_WD WHERE ICNUM=@ICNUM
END
VB调用该存储过程代码如下:
Public Function GetICStatus(StrICNum As String) As String
Dim IcNumber As New ADODB.Parameter
Dim Rs As ADODB.Recordset
With IcNumber
.Direction = adParamInput
.Type = adChar
.Size = 10
.Value = StrICNum
End With
With Cmd
.ActiveConnection = Con '该Con已经打开
.CommandType = adCmdStoredProc
.Parameters.Append IcNumber
.CommandText = "GetIcStatus"
Set Rs = .Execute '在这里出错提示:为过程或函数GetIcStatus指定的参数过多。 End With
If Not Rs.EOF Then
GetICStatus = Rs.Fields(0).Value
Else
GetICStatus = ""
End If
Set IcNumber = Nothing
Rs.Close
Set Rs = Nothing
End Function
实在匪夷所思。请指点迷津。
IC码 IC卡状态
ICNUM ICStatus
存储过程,如下:
CREATE PROCEDURE GetIcStatus
@ICNUM CHAR(10)
AS
BEGIN
SELECT ICSTATUS FROM TB_WD WHERE ICNUM=@ICNUM
END
VB调用该存储过程代码如下:
Public Function GetICStatus(StrICNum As String) As String
Dim IcNumber As New ADODB.Parameter
Dim Rs As ADODB.Recordset
With IcNumber
.Direction = adParamInput
.Type = adChar
.Size = 10
.Value = StrICNum
End With
With Cmd
.ActiveConnection = Con '该Con已经打开
.CommandType = adCmdStoredProc
.Parameters.Append IcNumber
.CommandText = "GetIcStatus"
Set Rs = .Execute '在这里出错提示:为过程或函数GetIcStatus指定的参数过多。 End With
If Not Rs.EOF Then
GetICStatus = Rs.Fields(0).Value
Else
GetICStatus = ""
End If
Set IcNumber = Nothing
Rs.Close
Set Rs = Nothing
End Function
实在匪夷所思。请指点迷津。
……
'打开数据库
Set CON = New ADODB.Connection
Set RS = New ADODB.Recordset
Set CMD = New ADODB.Command
CON.ConnectionString = "……"
CON.ConnectionTimeout = 30
CON.CursorLocation = adUseClient
CON.Open
CMD.ActiveConnection = CON
CMD.CommandType = adCmdStoredProc
CMD.CommandText = "GetIcStatus"
'追加输入参数ICNUM
Set Par = CMD.CreateParameter("ICNUM", adChar, adParamInput, 10, StrICNum )
CMD.Parameters.Append Par
SET Rs =CMD.Execute
……