in reply to Re^3: perl w/ DBI connectiong to MSSQL, not reporting SQL server trigger errors
in thread perl w/ DBI connectiong to MSSQL, not reporting SQL server trigger errors

After using eval around my DBI code, when the page loads, i get this following error: bind_col: column 2 is not a valid column (1..1) at /var/www/cgi-bin/archtmltest.pl line 306, line 8641. It's weird though. It only happens the first time i visit the page. Once I refresh it once, it's fine. And everytime i visit the page after that it's fine. It's only the very first time i visit the page that error shows up. Any ideas why? Thanks
  • Comment on Re^4: perl w/ DBI connectiong to MSSQL, not reporting SQL server trigger errors

Replies are listed 'Best First'.
Re^5: perl w/ DBI connectiong to MSSQL, not reporting SQL server trigger errors
by runrig (Abbot) on Jan 06, 2005 at 21:02 UTC
    Is it bad in any way to leave the code like this?
    No, it's perfectly perlish. Though you can now take out the checks you already had (if you haven't already taken them out). E.g. change this:
    if ($dbh = DBI->connect(...)) { ...
    to this:
    my $dbh = DBI->connect(...., {RaiseError => 1});
    Again, I'll also recommend using strict.