Ginger has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to implement a call to a SQL Server stored procedure from asp with perlscript webpage. The procedure def is:
Create Procedure DocDetailProc( @strID varchar(20) = '04971', @strName varchar(100) = '' OUTPUT, @strMainHtml varchar(8000) = '' OUTPUT, @strPracHtml varchar(8000) = '' OUTPUT)
The applicable asp section is:
$ID = $Request->QueryString('Key')->Item(1); use Win32::OLE::Const 'Microsoft ActiveX Data Objects 2.5'; $Conn = $Server->CreateObject("ADODB.Connection"); $cmd = $Server->CreateObject("ADODB.Command"); $Conn->Open("Provider=SQLOLEDB;DATA SOURCE=mis-interdev;UID=myUID;P +WD=myPWD;DATABASE=myDB;"); $cmd->{ActiveConnection} = $Conn; $cmd->{CommandType}=adCmdStoredProc; $cmd->{CommandText}='DocDetailProc'; $cmd->Parameters->Refresh(); $cmd->Parameters->{@strID}->{Value}=$ID; $cmd->Execute(); $Name=$cmd->Parameters->{@strID}->{Value}; $MainHtml=$cmd->Parameters->{@strMainHtml}->{Value}; $PracHtml=$cmd->Parameters->{@strPracHtml}->{Value}; %> <td width="585" align="left" height="18"><font face="Verdana" size= +"2"><%=$Name%> </font></td> <td width="253" align="center" rowspan="3" height="88"> </tr> <tr> <td width="185" valign="baseline" align="left" height="19"><strong +><small><font face="Verdana">Specialties</font></small></strong></td> <% $Response->Write($cmd->Parameters->{@strMainHtml}); $Response->Write($cmd->Parameters->{@strPracHtml}); $Conn->Close;
I've seen different ways of doing this, and the examples I've tried to implement do not work correctly. The full code gets no syntax errors, but the fields @strName, @strMainHtml and @strPracHtml are blank. I'm new at this. Any suggestions would be wonderful! Thanks!

Replies are listed 'Best First'.
Re: ASP Perlscript and stored procedures
by Juerd (Abbot) on May 23, 2002 at 18:10 UTC

    $Response->Write($cmd->Parameters->{@strMainHtml});

    @strMainHTML is an array. Did you mean strMainHTML or '@strMainHTML'?

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

      Thanks, Juerd. I didn't see your reply. Looks like we came to the same conclusion, anyway. Thanks much! :)
Re: ASP Perlscript and stored procedures
by Ginger (Novice) on May 23, 2002 at 18:24 UTC
    I figured out my problem, the values needed to be enclosed in quotes as such:
    $MainHtml=$cmd->Parameters->{'@strMainHtml'}->{Value}; $PracHtml=$cmd->Parameters->{'@strPracHtml'}->{Value};
    No help needed. Thanks!