I have a perl script that calls a stored proc in MSSQL 2008. When I run the script I get this error: MicrosoftODBC SQL Server DriverSQL ServerThe formal parameter "@Username" was not declared as an OUTPUT parameter, but the actual parameter passed in requested output. (SQL-42000) The perl code I use is (I have removed the connection UID and PASS for security):
#!perl -w use strict; use CGI q~:standard~; use DBI; use Digest::MD5 q~md5~; use CGI::Carp q~fatalsToBrowser~; my ($DBH, $STH, $Username, $Password, $Error, $Cookie); $Username = param('Username'); $Password = param('Password'); $Password = md5($Password); $DBH = DBI -> connect ('dbi:ODBC:SQLServer', '', '') or die "$DBI::err +str"; $STH = $DBH -> prepare (qq~exec FinalFantasyInfo.dbo.CheckLogIn ?, \@U +sername = '$Username', \@Password = '$Password'~) or die "DBI::errstr +"; $STH -> bind_param_inout(1, \$Error, 1); $STH -> execute or die "$DBI::errstr"; if ($Error == 1) { print redirect('http://admin.ffinfo.com/login2.html'); } else { $Cookie = new CGI::Cookie (-name => 'FFAdmin0229', -value => ['$Username', '$Password'] ); $Cookie -> bake; print redirect('http://admin.ffinfo.com/portal.html'); }
my stored proc looks like this:
create proc CheckLogIn ( @Username varchar(50), @Password varchar(50), @Error tinyint output ) as if (select COUNT(*) from FinalFantasyInfo.dbo.MainStaffInfo where UID += @Username and Password = @Password) = '1' set @Error = '0' else set @Error = '1'
I have been looking for a while now and just can't see the error, I am sure it is something small and stupid. Can someone give me a second set of eyes and see if they can find it?

In reply to Need a second set of eyes, can't find the error by MatthewV

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.