Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stored procedure parameter
Message
De
31/07/1999 22:37:37
 
 
À
Tous
Information générale
Forum:
Visual Basic
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Titre:
Stored procedure parameter
Divers
Thread ID:
00248636
Message ID:
00248636
Vues:
45
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
Fil
Voir

Click here to load this message in the networking platform