Add error checking to your code.  The easiest way is in the connect
statement:

my $dbh = DBI->connect( 'dbi:ODBC:myDSN, '','', {PrintError => 1,
RaiseError => 1} ) or die $DBI::errstr;

or check each statement.

Suggestion, review perldoc DBI.

Tom

On Wed, May 23, 2001 at 02:46:56PM +0700, Krung   Saengpole wrote:
> use DBI;
> 
> $dbh = DBI->connect('dbi:ODBC:myDSN', '','');
> $sth = $dbh->prepare("Select * From TotalLevel") 
        or die/croak/call sub
        or
        if ($dbh->err) ... 
> $sth->execute();
> while (@data = $sth->fetchrow_array) {
        if ($sth->err) ...
>   foreach (@data){
>     print "$_ \t";
>   }
>   print "\n";
> }
> $sth->finish;
> $dbh->disconnect;

-- 
Thomas A. Lowery
See DBI/FAQ http://tlowery.hypermart.net

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to