récupération de la valeur retournée par une procédure stockée
Bonjour,
j'ai essayé de récupérer la valeur rendue par la procédure stockée mais ça ne marche plus.
1- la procédure stockée :
Code:
1 2 3 4 5 6 7 8 9
|
CREATE PROCEDURE maproc
@param integer output
AS
INSERT INTO T1 VALUES ('aaa')
SET @param =SCOPE_IDENTITY()
GO |
2-programme VB :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
Public Function fct() As Integer
Dim objCommand As ADODB.Command
Set objCommand = New ADODB.Command
Dim parametre As ADODB.Parameter
Set parametre = objCommand.CreateParameter("x",adInteger,adParamOutput)
With objCommand
.ActiveConnection = ADOConn
.CommandType = adCmdStoredProc
.CommandText = "maproc"
.Parameters.Append (parametre)
.Execute
End With
fct = objCommand.Parameters.Item("x").Value
Set objCommand.ActiveConnection = Nothing
End Function |
3-Page ASP :
Code:
1 2 3 4
|
Set obj = CreateObject("xxx.Classe")
Dim param2
param2= obj.fct("maproc") |
quand je fait
alert("<%=param2%>") ça ne me donne rien. j'ai l'erreur : Un objet est requis
c'est une erreur au niveau du programme vb.
l'élément ne s'insère plus.
Merci pour vos aides