Trying to use a stored procedure

Trying to use a stored procedure

am 01.02.2007 15:34:04 von bobby_b_

Hello,
I'm trying to access a stored procedure on our AS400 that is written
in RPG. I know that the stored procedure works (I've called it from
an RPG program on the AS400), and I know that the connection to the
AS400 is good, because this same ASP page is reading data via SQL.
However, when I try to call the stored procedure, I can't tell if
anything is actually happening. All that I know is that the end
result is not being changed, so I suspect that the procedure isn't
being called correctly.
My stored procedure is used to encrypt/decrypt data. It has 3
parameters - a 1 character flag telling it whether to encrypt or
decrypt, a 25 character field for the plaintext data, and a 50
character field for the encrypted data. The last two parameters are
used for either input or output, depending on the value of the first
flag (if the flag is "E", then the plaintext is used as input and the
program fills the encrypted data field. If the flag is "D", then vice-
versa).

Here is the code where I call my stored procedure. I'm trying to
decrypt data from the queryString and place it in some program
variables. I'm new to ASP, and can't find any good examples for my
situation, so I pieced this together from what examples I found
online. Can anyone tell me what I'm missing? Thanks in advance!

dim cmd
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection = cn
cmd.CommandText = "ENCRYPTDECRYPT"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("FUNCTION", adChar, _
adParamInput, 1)
cmd.Parameters.Append cmd.CreateParameter("PLAINTEXT", adChar, _
adParamInputOutput, 25)
cmd.Parameters.Append cmd.CreateParameter("CYPHERTEXT", adChar,
_
adParamInputOutput, 50)
cmd.Parameters("FUNCTION") = "D"
cmd.Parameters("CYPHERTEXT") = Request.QueryString("user")
cmd.Execute

sUser = cmd.Parameters("PLAINTEXT")

cmd.Parameters("CYPHERTEXT") = Request.QueryString("pwd")
cmd.Execute

sPwd = cmd.Parameters("PLAINTEXT")