<%@ LANGUAGE = PerlScript%> ADO Stored Procedures That Return Values
ActiveState PerlScript


ActiveX Data Objects (ADO) Stored Procedures That Return Values

Returning values from a stored procedure. The procedure looks as follows:
CREATE PROC Test 
AS
RETURN(64)


Output from stored procedure:
<% $cmd = $Server->CreateObject('ADODB.Command'); $conn = $Server->CreateObject('ADODB.Connection'); $conn->Open(<{ActiveConnection} = $conn; $cmd->{CommandText} = 'Test'; # Name of stored procedure $cmd->{CommandType} = 4; # Says it will return a value $cmd->Parameters->Append( $cmd->CreateParameter('RetVal', 2, 4) ); $cmd->Execute(); # Execute the stored procedure print $cmd->Parameters('RetVal')->{Value}; $conn->Close(); undef($conn); undef($cmd); %> <% $url = $Request->ServerVariables('PATH_INFO')->item; $_ = $Request->ServerVariables('PATH_TRANSLATED')->item; s/[\/\\](\w*\.asp\Z)//m; $params = 'filename='."$1".'&URL='."$url"; $params =~ s#([^a-zA-Z0-9&_.:%/-\\]{1})#uc '%' . unpack('H2', $1)#eg; %>

Return

view the source