Information générale
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Titre:
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement