Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Extracting data from an Ms ACCESS query

by blackadder (Hermit)
on Jun 11, 2004 at 12:16 UTC ( #363388=note: print w/replies, xml ) Need Help??


in reply to Re^2: Extracting data from an Ms ACCESS query
in thread Extracting data from an Ms ACCESS query

Yes, I tried this;
my $result = $dbh->sql("SELECT * FROM $qry WHERE group_name='Procureme +nt'"); foreach (@$result) { print @$_; }
and I got this;
Can't use string ("1") as an ARRAY ref while "strict refs" in use at U +:\scripts\odbc1.pl line 15.
Hmmmm. Holy ones please HELP!

Blackadder

Replies are listed 'Best First'.
Re^4: Extracting data from an Ms ACCESS query
by maa (Pilgrim) on Jun 11, 2004 at 12:45 UTC

    Hi, blackadder

    have you read the documents Win32::ODBC?

    As has already been said, it's $dbh->Sql($statement) not $dbh->sql() and it does not return an arrayref... it returns undef upon success!

    $sql="select * from foo"; if($db->Sql($sql)) { warn "i failed: " . $db->Error(); }else{ print "read the documentation on FetchRow(), Data() and DataHash() +\n"; }

    HTH - Mark

Re^4: Extracting data from an Ms ACCESS query
by blackadder (Hermit) on Jun 11, 2004 at 13:56 UTC
    Thanks maa

    Yes I have read the Win32::ODBC but there is no examples it it!!!

    but so far you have given me enough stuff to work on...Cheers

    Blackadder
      Use DBD::ODBC instead of Win32::ODBC. It is much better documented, supported, and widely known.
Re^4: Extracting data from an Ms ACCESS query
by periapt (Hermit) on Jun 11, 2004 at 19:09 UTC
    Darn, I meant to include this in my post below. To sort of repeat myself, the Sql call in Win32::ODBC will return either false, for a successful query or an error number if the query fails. You are storing this number in $result and trying to use it as an array reference in your print statement. From your print error message, your sql call is returning the value "1" which I think is an error from the Win32::ODBC module itself. The ODBC statement is actually $dbh->Sql() not $dbh->sql().

    PJ
    We are drowning in information and starving for knowledge - Rutherford D. Rogers
    What good is knowledge if you have to pull teeth to get it - anonymous

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://363388]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2023-10-02 08:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?