PDOStatement::errorCode
Retrieves the SQLSTATE of the most recent operation on the database statement object.
Syntax
string PDOStatement::errorCode();
Return Value
Returns a five-char SQLSTATE as a string, or NULL if there was no operation on the statement handle.
Remarks
Support for PDO was added in version 2.0 of the Microsoft Drivers for PHP for SQL Server.
Example
This example shows a SQL query that has an error. The error code is then displayed.
<?php
$conn = new PDO( "sqlsrv:server=(local) ; Database = AdventureWorks", "", "");
$stmt = $conn->prepare('SELECT * FROM Person.Addressx');
$stmt->execute();
print $stmt->errorCode();
?>
See Also
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin