PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: problems with "results pending"
Date: Jun 1 1999 1:59PM

Laurent de LASTEYRIE writes:
 > 	I use this code :
 > 
 > " $genere->dbcmd($sql_cmd);
 >   $genere->dbsqlexec;
 >   $genere->dbresults;
 >   my %dat;
 >   if (%dat = $genere->dbnextrow(1)) {
 >     print "$dat{Num}\n";
 >     print "$dat{Name}\n";
 >     @date2 = %dat;
 >     print "$date2[0], $date2[1]\n";
 >   }
 >     $genere->dbcmd($sql_cmd2);
 >     $genere->dbsqlexec;
 >     $genere->dbresults;
 >     my %StatusStu;
 >     %StatusStu = $genere->dbnextrow(1);
 >     print "$StatusEtud{StatusE}\n";
 >     print "$StatusEtud{C_Section}\n";    
 > "
 > 
 > And when i run it, i always got this error :
 > "
 > DB-Library error:
 >         Attempt to initiate a new SQL Server operation with results pending.
 > "
 >     I have only one students with this number, then i don't understand why
 > there is this error, and most of all, how can i resolve it ?

Always call dbresults() in a loop, until it returns NO_MORE_RESULTS,
as in:

while($dbh->dbresults != NO_MORE_RESULTS) {
    while(%dat = $dbh->dbnextrow(TRUE)) {
       ... do something with the data...
    }
}

Michael
-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@peppler.org    -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com