General information
Category:
Database DAO/RDO/ODBC/ADO
Title:
Stored procedure parameter
I'm on a project that deal with SQL 7. I'm using ADO/ODBC and have no problem. But, I was asking myself if ther was any way of skiping a parameter when calling a stored procedure ? Here an exemple of my code
Dim cmd As New ADODB.Command
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "sp_InsertClient"
cmd.Parameters.Refresh
cmd.Parameters(1) = iClientID
cmd.Parameters(2) = sUserName
cmd.Parameters(3) = sPassword
cmd.Execute
And I want to call the same procedure but with only 2 parameters like this
Dim cmd As New ADODB.Command
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "sp_InsertClient"
cmd.Parameters.Refresh
cmd.Parameters(1) = iClientID
cmd.Parameters(2) = sPassword
cmd.Execute
Also, I handle my error(s) with a Resume Next when a parameter in NULL. But I don't feel comfortable with this way (Like if sPassword is NULL or empty and there is no Resume Next, I will get an ODBC error).
Thanks in advance
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only