I have just gotten into using stored procs in MS SQL 2005 to move a lot of the logic from perl to T-SQL and now I am just learning how to call those procs and pass information to them. I though I understood what needed to be coded but aparently not as I am getting two errors I can't find the cause of. Can anyone look over the code with a fresh set of eyes to see what I can't find in the past few hours of debuging. Thanks
Code:
#!/user/bin/perl -w use strict; use CGI::Carp qq~fatalsToBrowser~; use CGI q~:standard~; use DBI; print "Contect-type: text/html\n\n"; my ($DBH, $STH, $Creator, $ContactMethod, $Contact, $FileName, $Game, +$Section, $Width, $Height, $File, $FileHandel, $Result, $Error); $Creator = param('Creator'); $ContactMethod = param('ContactMethod'); $Contact = param('Contact'); $FileName = param('FileName'); $Game = param('Game'); $Section = param('Section'); $Width = param('Width'); $Height = param('Height'); $File = param('File'); $File =~ s/.*[\/\\](.*)/$1/; $FileHandel = upload('File'); $Error = 0; mkdir ("e:/web/public_html/finalfantasyinfo/ffinfo/protected/images/av +atars/$Game"); mkdir ("e:/web/public_html/finalfantasyinfo/ffinfo/protected/images/av +atars/$Game/$Section"); $DBH = DBI -> connect ('dbi:ODBC:FFInfocom', '', '') or die "$DBI::err +str;"; $STH = $DBH -> prepare (qq~exec AddAvatars ?, \@Creator = '$Creator', +\@ContactMethod = '$ContactMethod', \@ContactAddress = '$Contact', \@ +AvatarName = '$FileName, \@Game = '$Game', \@Section = '$Section', \@ +Width = '$Width', \@Height = '$Height'~) or die "$DBI::errstr;"; $STH -> bind_param_inout(1, \$Error, 1); $STH -> execute or die "$DBI::errstr;"; if ($Error == 0) { open UPLOADFILE, ">e:/web/public_html/finalfantasyinfo/ffinfo/prot +ected/images/avatars/$Game/$Section/$File"; binmode UPLOADFILE; while (<$FileHandel>) { print UPLOADFILE; } close UPLOADFILE; $Result = 'New Avatar added'; } else { $Result = 'That Avatar already exists. Please add another one or c +hange the file name and try again.'; } &PrintHTML; sub PrintHTML { print qq~<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN +" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Final Fantasy Info.com Site Administration Section</title> <meta name="description" content="Final Fantasy Info.com Site Administ +ration Section" />~; open (FILE, 'e:\web\public_html\finalfantasyinfo\ffinfo\ssi\header.txt +') or die 'Can not open e:\web\public_html\finalfantasyinfo\ffinfo\ss +i/header.txt'; print <FILE>; close FILE; print qq~</head> <body onload="columnheight(); highlight()"> <div style="text-align: center; margin-bottom: 2px"><img src="http://w +ww.ffinfo.com/images/misc/sitebanner.jpg" width="950" height="100" al +t="Welcome to Final Fantasy Info.com - The Best Place to Find Everyth +ing Final Fantasy!" /></div>~; open (FILE, 'e:\web\public_html\finalfantasyinfo\ffinfo\ssi\nav.txt') +or die 'Can not open e:\web\public_html\finalfantasyinfo\ffinfo\ssi\n +av.txt'; print <FILE>; close FILE; print qq~<div id="leftcolumn">~; open (FILE, 'e:\web\public_html\finalfantasyinfo\ffinfo\admin\menu.txt +') or die q~Can not open e:\web\public_html\finalfantasyinfo\ffinfo\a +dmin\menu.txt~; print <FILE>; close FILE; print qq~</div> <div id="maincolumn"><div class="sectioncontent">$Result</div> </div> <div id="copywrite">~; open (FILE, 'e:\web\public_html\finalfantasyinfo\ffinfo\ssi\copywrite. +txt') or die 'Can not open e:\web\public_html\finalfantasyinfo\ffinfo +\ssi\copywrite.txt'; print <FILE>; close FILE; print qq~</div> </body> </html>~; }

Errors I get:
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ' +Test4'. (SQL-42000) [Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark + after the character string ''. (SQL-42000) [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not +be prepared. (SQL-42000)(DBD: st_execute/SQLExecute err=-1); at e:\we +b\public_html\finalfantasyinfo\ffinfo\admin\avatars\addavatar.pl line + 25.

Any thoughts of the cause of the problem would be welcomed, along with any thoughts of improve the security and function of the script. Thanks

Content restored by GrandFather


In reply to Help debuging a script that uses commands I am just learning by Eagle_f91

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.