hi all
firstable, i've read thru several threads here and some other docs - can't
find the solution :(
i'm trying to get the output parameter of a stored procedure back into ASP.
the SP is somewhat set as is, can't do much about it.
there are about 15 input and 1 output parameter in the SP. all parameters
have a default. as a first step i only need to call the procedure and get
the output parameter (a ID) back.
this is what i tried so far, copied from examples...
----------
Set cmd = Server.CreateObject("ADODB.command")
cmd.ActiveConnection = session("wwwcn")
cmd.CommandText = "newAccount"
cmd.CommandType = 4
Set param1 = cmd.CreateParameter("Output",3,2) <--- IIS would not accept
constants like adParamOutput....
param1.value=0
cmd.Parameters.Append param1
Set rs = cmd.Execute
While Not rs.EOF
For Each fldloop In rs.Fields
Response.Write("rs.Fields(i)")
i = i + 1
Next
i = 0
rs.MoveNext
Wend
---------
the first parameter in the SP is the Output parameter, is defaulted to 0 and
will contain the newly created ID.
if i run this code, following errormessage at the "cmd.execute" line
appears: (translated from english)
"The Value NULL cannot be inserted into blablabla" it's a constrain.
if i run "exec newAccount" in Query Analyzer it works
what is wrong ? i also need to know, if i can use named parameters
named parameters are possible, aren't they, plleaaase
please, do not suggest to change the SP.
thanks a lot for any help.
Beat
PS. this command object is a incredibly annoying way to handle SP
output/input values. i hate it... it's like the developpers sat together and
asked "how could we make as a complicated as humanly possible". but well,
maybe someone can shed some light on this. i hope so.
Beorda Direktwerbung AG
Abteilung EDV
Kantonsstrasse 101
6234 Triengen
Tel.: 041 935 40 60
Fax: 041 935 40 76
Tel. direkt: 041 935 40 68