Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

PDOStatement::closeCursor

SQL Server 2008 R2

Closes the cursor, enabling the statement to be executed again.


bool PDOStatement::closeCursor();

true on success, otherwise false.

closeCursor has an effect when the MultipleActiveResultSets connection option is set to false. For more information about the MultipleActiveResultSets connection option, see How to: Disable Multiple Active Resultsets (MARS).

Instead of calling closeCursor, you can also just set the statement handle to null.

Support for PDO was added in version 2.0 of the Microsoft Drivers for PHP for SQL Server.

<?php
$database = "AdventureWorks";
$server = "(local)";
$conn = new PDO( "sqlsrv:server=$server ; Database = $database", "", "", array('MultipleActiveResultSets' => false ) );

$stmt = $conn->prepare('SELECT * FROM Person.ContactType');

$stmt2 = $conn->prepare('SELECT * FROM HumanResources.Department');

$stmt->execute();

$result = $stmt->fetch();
print_r($result);

$stmt->closeCursor();

$stmt2->execute();
$result = $stmt2->fetch();
print_r($result);
?>

Reference

Other Resources

PDO
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.