Bonjour,

Je suisi en train de me dépatouiller tant bien que mal avec les procédures stockées de SQL Server.

J'ai la procédure stockée suivante :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
CREATE PROCEDURE dbo.CompteAllFichierSource
AS
BEGIN
DECLARE @NbFichiers INT
Select @NbFichiers = 1
END
GO
que j'attaque par le vbscript :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
    const SZ_COUNT_ALL_SOURCE_SP_NAME = "CompteAllFichierSource"
    const adCmdStoredProc = &H0004
    const adInteger = 3
    const adParamReturnValue = &H0004
    const adExecuteNoRecords = &H00000080
 
    set oCommand = WScript.CreateObject("ADODB.Command")
 
    oCommand.ActiveConnection = oConnection
 
    oCommand.CommandText = SZ_COUNT_ALL_SOURCE_SP_NAME
 
    oCommand.CommandType = adCmdStoredProc
 
    oCommand.Parameters.Append oCommand.CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue)
 
    oCommand.Execute iNbRecords, , adExecuteNoRecords
 
   MsgBox oCommand.Parameters("RETURN_VALUE")
 
   set oCommand = nothing
Je ne dois pas être très loin d'accéder à mon résultat. Pourtant la MsgBox me retourne 0 alors qu'elle devrait (à moins que je me trompe) retourner 1.

Avez-vous une idée ?

Merci d'avance.