here's the error message:
Can't call method "Fields" on unblessed reference

I'm using ASP-Perl and taking a value from a form to execute a query against an SQL database.

my $SQLstring = "SELECT * FROM table WHERE field1='"; my $filter = $Request->Form('USERFIELD')->$Item(); # this is taken directly out of the pages of # the O'Reilly Book CGI Programming. # I try to "clean up" the data that was entered # by the user and then take that # 'untainted data' out of a system variable # # the program dosen't work with or without this statement $filter=~ /^([\w.])$/; $filter = $1; $SQLstring .= $filter my $Provider = "SQLOLEDB"; my $ConnectString = "driver={SQL Server};server=SRVR;database=DB"; my $Conn = $Server->CreateObject("ADODB.Connection"); $Conn->Open($ConnectString); my $RS = $Conn->Execute( "$SQLstring" ); # this is the line on which the error occurs while ( ! $RS->{EOF} ) { $Response->Write($RS->Fields(0)->{Value}); $RS->MoveNext; } $RS->close;

This whole thing is intended to happen within a subroutine. If i'm going to run into troubles passing ADODB Recordsets around, please lemme know. I'm figuring that they're references to objects and shouldn't matter but it might.


In reply to How do I go about Blessing an Object? by Buckaroo Buddha

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.