Thanks, The snippet now looks like this:
my $db = new Win32::ODBC('$DSN'); if (defined $dept) { if (exists $labels{$dept}) { # FIXME # untaint $dept and put it into database print $cgi->start_html, $cgi->p("$dept was received."); $cgi->end_html; if ($dept eq "CA") { if (!($db=new Win32::ODBC('$DSN'))) { $cgi->p("Error connecting to Database"); $cgi->p("Error: " . Win32::ODBC::Error ) . " "); } my $SqlStatement ='SELECT * FROM Pipeline WHERE Publish<="19 Apr 2006" + AND Expiry>="19 Apr 2006" AND CA="Must Read"'; print $SqlStatement; $db->Sql('$SqlStatement');
I'm still getting this error:
:\Perlcgi\Pipeline\cgi.pl: Can't call method "Sql" on an undefined val +ue at E:\Perlcgi\Pipeline\cgi.pl line 51.
Line 51 is:    $db->Sql('$SqlStatement'); It's like it won't substitute the contents $SqlStatement or something? Why is that?

Incidentally, if I drop in the SQL Statement in that Line 51 code it still gives the same error message. Does CGI need me to express the $db->Sql() differently?


In reply to Re^5: Perl CGI and SQL statements by kjg
in thread Perl CGI and SQL statements by kjg

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.