Cake 3.5 Get multil select from stored procedure SQL Server

I try use this code to get mutil select from stored procedure but I can’t:

>$connection = ConnectionManager::get('default');
>         $stmt = $connection->execute($query)->getInnerStatement();

>         $results = [];
>         do {
>             try {
>                 $results[] = $stmt->fetchAll(\PDO::FETCH_OBJ);
>             } catch (\Exception $ex) {

>             }
>         } while ($stmt->nextRowset());

I get an error: Call to undefined method Cake\Database\Statement\SqlserverStatement::nextRowset(), and then I try the same in Cake\Database\Statement\PdoStatement->fetchAll() function like this:

> $stmt = $this->_statement;

>         $results = [];
>         do {
>             try {
>                 $results[] = $stmt->fetchAll(PDO::FETCH_ASSOC);
>             } catch (\Exception $ex) {

>             }
>         } while ($stmt->nextRowset());

I got an error: Error: No ODBC error was found, but I installed ODBC driver 13 for SQL Server 2014.
How do I get multil select from stored procedure SQL Server?

Error messages in PHP are pretty much in the name of the error message. Basically means that whatever the error is saying IS what you need to fix. It’s literally written in plain English.

It’s saying that you are trying to access a method/function that doesn’t exist from a class you are using.


Have you ever heard of Pokémon Exception Handling?

Oh no, I know this function doesn’t exist. I know if I only use php (dont use any php framework), I can easily get statement from PDO Object but when I try the same thing then I got an error. I need solution, not how to fix my code because it’s example and I’m not in any project. Have you ever work with cakephp and connect it to SQL Server?

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.