in reply to (Ovid) Re: Loop Question
in thread Loop Question

When I run just the SQL manually in Access, it works fine. I get the output I want: All "P" transactions for "x" customer. I am getting this data from a database. I will try your suggestion to print out the SQL and see what happens from there. Thanks.

Replies are listed 'Best First'.
Re: Re: (Ovid) Re: Loop Question
by Ovid (Cardinal) on Mar 21, 2001 at 21:56 UTC
    I forgot to mention a couple of things:

    When instantiating the DBI object, make sure that you have "RaiseError" set to 1:

    my $dbh = DBI->connect("dbi:ODBC:$DSN", $USER, $PASSWORD, {RaiseError => 1})
    By doing that, you won't have to test for errors everywhere. It will automatically throw an exception on an error. Also, if you really want to see what DBI is doing under the hood, try the DBI->trace method. This node has a good example of how it works. (That's a shameless plug because it's one of my nodes :)

    Just make sure that you set the trace number low, at first. If it's too high, your output file will be flooded with a bunch of information that is probably meaningless.

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Re: Re: (Ovid) Re: Loop Question
by Anonymous Monk on Mar 21, 2001 at 22:02 UTC
    The SQL printed out fine. It is what I want it to query. I forgot to take the # sign out of the code when I copied it to the question. But that isn't the problem.