KrYo has asked for the wisdom of the Perl Monks concerning the following question:

Hello... i don't know if this is a ODBC problem or a Perl problem....

the setup is this

i have a M$ Access database with a table with approx. 2500 rows... i want to return all rows.

I do the Select thingy and all that... "FetchRow" also however i do only get about 20 rows in return... really strange... i have checked alot ... i've used the "MoreResults()" and it returns...

"Error checking for more result sets: 911No data records remain.20"

But i know there are a whole lotta more rows in the db.

Anyone?

Replies are listed 'Best First'.
Re: WIN32::ODBC Returning to few rows...
by physi (Friar) on Mar 30, 2001 at 14:05 UTC
    Are you sure not to use set rowcount 20 somewhere in your query :)
    But maybe you can post some of your code here. Then it would be easier to figure it out ..
Re: WIN32::ODBC Returning to few rows...
by KrYo (Initiate) on Mar 30, 2001 at 17:17 UTC
    Set rowcount ? no hehe :)

    here's the code.... remember it returns 20 rows

    #!perl
    
    use Win32::ODBC;
    
    $DSN = "cheat";
    if (!($db = new Win32::ODBC($DSN))){
        print "Error connecting to $DSN\n";
        print "Error: " . Win32::ODBC::Error() . "\n";
        exit;
    }
    
    
    if (!($dbORG = new Win32::ODBC($DSN))){
        print "Error connecting to $DSN\n";
        print "Error: " . Win32::ODBC::Error() . "\n";
        exit;
    }
    
    $SqlStatement = "SELECT * FROM tblCheats";
    if ($dbORG->Sql($SqlStatement)){
        print "SQL failed.\n";
        print "Error: " . $dbORG->Error() . "\n";
        $$dbORG->Close();
        exit;
    }	
    
    while($dbORG->FetchRow()){
        undef %Data2;
        %Data2 = $dbORG->DataHash();
    	print "$Data2{'name'}\n";
    }
    
    
      In your code you are only printing rows with $Data2{'name'} in it. If you want to return all rows, I guess you have to change 'name' into a variable pertaining to the column you want to count the row of.
      Anyone?