Please excuse my complete newbieness. This problem may actually be a SQL syntax error, but I don't know enough to tell. I'm executing a command to get users who are logged into some pcs (defined by a list) and then dump the results into a SQL (MS) table. I'm using win32::odbc to connect to the database (connectivity appears to be fine).
my($db) = new Win32::ODBC("user_logons"); while (my $machine = <MACHINEFILE>) { my @Results = (); @Results = `psloggedon.exe \\\\$machine`; my $LocUsr = $Results[6]; [...] $db->Sql("INSERT INTO <Data> (pc_name, user_name,time+date) " . +"VALUES ($machine, $LocUsr, GETDATE())"); }
The table name "Data" and field names are correct. $machine and $LocUsr variables are defined - they seem fine when I print. The error message I get is "Can't call method SQL on an undefined value at line 46, <machinefile> line 1". Obviously, if that syntax looks ok, I'll recheck connectivity-type stuff. Any wisdom dispensed much appreciated!

In reply to win32::odbc/ SQL error by billie_t

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.