hello,

i'm running my script on a win2000 box called eggpayorteam. i have
established a ODBC system DSN name of "eggpayorteam" and have set the
default database to "eggsupp". when i run my queries below i get errors,
noted further below. when i remove "use eggsupp" it runs fine. is this
strange behavior? and why is this happening?

sth = $dbh->prepare("
        use eggsupp
        select count(fileid) as number from filesupp fs 
        where datecreated >= '$past' and datecreated <= '$today'
        ");

$sth->execute;

while( my @data = $sth->fetchrow_array)
{
        $total_num = $data[0];
        print "$total_num\n\n\n";
}

###### query 2#

$sth = $dbh->prepare("
        use eggsupp
        select count(fileid), crashtypedescr   
        from filesupp fs  join crashtype ct on fs.crashtype = ct.crashtypeid
where crashtype <> ''
        and  datecreated >= '$past' and datecreated <= '$today'
        group by crashtype,crashtypedescr
        ");

$sth->execute;

---------------------


DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver]Invalid
cursor
state (SQL-24000)(DBD: dbd_describe/SQLNumResultCols err=-1) at
C:\perl\scripts\
crash_pie.pl line 59.
DBD::ODBC::st fetchrow_array failed: (DBD: no select statement currently
executi
ng err=-1) at C:\perl\scripts\crash_pie.pl line 61.
DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver]Invalid
cursor
state (SQL-24000)(DBD: dbd_describe/SQLNumResultCols err=-1) at
C:\perl\scripts\
crash_pie.pl line 77.
DBD::ODBC::st fetchrow_array failed: (DBD: no select statement currently
executi
ng err=-1) at C:\perl\scripts\crash_pie.pl line 79.

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

Reply via email to