title: PDOException SQLSTATE[IMSSP] there is a statement with pending results
body: <p>Technologies used:</p>
  
  <p>DOCTRINE 2.4.*/
  PHP 5.3.0/
  SQL SERVER 2000/
  XAMPP 1.7.2</p>
  
  <p>The SQL Server 2000 is installed on Windows 2003 Server.</p>
  
  <p>This web application on a computer with XAMMP and windows 7 32bit.</p>
  
  <p>To connect to the database sql server 2000 I need the driver sqlsrv2.0 and install windows 2008 native client 32 bits.
  For this, I add in the file php.ini:</p>
  
  <pre><code>extension=php_sqlsrv_53_ts_vc9.dll
  
  extension=php_pdo_sqlsrv_53_ts_vc9.dll
  </code></pre>
  
  <p>Now, when I run phpinfo() shows me sqlsrv pdo drivers.</p>
  
  <p>When I query the database in an error occurs.
  The connection to the database is ok. When I use the method find () or findAll () it works.</p>
  
  <p>citas.php:</p>
  
  <pre><code>&lt;?php
  
  require_once "../doctrine/bootstrap.php";
  $query = $entityManager-&gt;createQuery('SELECT c FROM Cita c WHERE (c.CodigoCita&gt;?1)');
  $query-&gt;setParameter(1,100);
  $citas = $query-&gt;getResult();
  echo count($citas);
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>br /&gt;
  
      &lt;b&gt;Fatal error&lt;/b&gt;:  Uncaught exception 'PDOException' with message 'SQLSTATE[IMSSP]: 
      The connection cannot process this operation because there is a statement with pending results.  
      To make the connection available for other queries, either fetch all results or cancel or free the statement.  
      For more information, see the product documentation about the MultipleActiveResultSets connection option.' 
      in C:\xampp\htdocs\HistoriaRedonda\doctrine\vendor\doctrine\dbal\lib\Doctrine\DBAL\Connection.php:694
      Stack 
      trace:
      #0 C:\xampp\htdocs\HistoriaRedonda\doctrine\vendor\doctrine\dbal\lib\Doctrine\DBAL\Connection.php(694): PDOStatement-&amp;gt;execute()
  
      #1 C:\xampp\htdocs\HistoriaRedonda\doctrine\vendor\doctrine\orm\lib\Doctrine\ORM\Persisters\BasicEntityPersister.php(748): Doctrine\DBAL\Connection-&amp;gt;executeQuery('SELECT t0.Codig...', Array, Array)
  
      #2 C:\xampp\htdocs\HistoriaRedonda\doctrine\vendor\doctrine\orm\lib\Doctrine\ORM\Persisters\BasicEntityPersister.php(829): Doctrine\ORM\Persisters\BasicEntityPersister-&amp;gt;load(Array, NULL, Array)
  
      #3 C:\xam in &lt;b&gt;C:\xampp\htdocs\HistoriaRedonda\doctrine\vendor\doctrine\dbal\lib\Doctrine\DBAL\DBALException.php&lt;/b&gt; on line &lt;b&gt;91&lt;/b&gt;&lt;br /&gt;
  </code></pre>
  
  <p>Connection.php:694Stack:</p>
  
  <pre><code>public function executeQuery($query, array $params = array(), $types = array(), QueryCacheProfile $qcp = null)
      {
          if ($qcp !== null) {
              return $this-&gt;executeCacheQuery($query, $params, $types, $qcp);
          }
  
          $this-&gt;connect();
  
          $logger = $this-&gt;_config-&gt;getSQLLogger();
          if ($logger) {
              $logger-&gt;startQuery($query, $params, $types);
          }
  
          try {
              if ($params) {
                  list($query, $params, $types) = SQLParserUtils::expandListParameters($query, $params, $types);
  
                  $stmt = $this-&gt;_conn-&gt;prepare($query);
                  if ($types) {
                      $this-&gt;_bindTypedValues($stmt, $params, $types);
  line 694                   $stmt-&gt;execute();
  
  
                  } else {
                      $stmt-&gt;execute($params);
  
                  }
  
              } else {
                  $stmt = $this-&gt;_conn-&gt;query($query);
              }
  
          } catch (\Exception $ex) {
              throw DBALException::driverExceptionDuringQuery($ex, $query, $this-&gt;resolveParams($params, $types));
          }
  
          $stmt-&gt;setFetchMode($this-&gt;defaultFetchMode);
  
          if ($logger) {
              $logger-&gt;stopQuery();
          }
  
          return $stmt;
  
      }
  </code></pre>
  
  <p>bootstrap.php:</p>
  
  <pre><code>&lt;?php header('Content-Type: text/html; charset=UTF-8');
  use Doctrine\ORM\Tools\Setup;
  use Doctrine\ORM\EntityManager;
  
  require_once 'vendor/autoload.php';
  
  
  $isDevMode = true;
  $conn = array(
      'driver'   =&gt; 'pdo_sqlsrv',
      'host'     =&gt; '192.168.1.6',
      'dbname'   =&gt; 'MedicosCopia272015',
      'user'     =&gt; 'XXX',
      'password' =&gt; 'XXXXXXXXXX',
      'MultipleActiveResultSets' =&gt; false
  );
  
  $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__."/src"), $isDevMode);
  $entityManager = EntityManager::create($conn, $config);
  </code></pre>