2015-05-12 73 views
1

我通过freetds驱动程序使用pdo连接到Mssql数据库,我想输出详细的SQL错误对通用的错误。 例如我从PDO得到这个一般错误Pdo mssql错误消息

SQLSTATE[HY000]: General error: 547 General SQL Server error: Check messages from the SQL Server [547] (severity 16) [(null)] 

但SQL客户端给了我更多的细节,我想让他们在PHP中。例如。在同一案件中:

The DELETE statement conflicted with the REFERENCE constraint "FKORDINICLIENTI". The conflict occurred in database "dbo.Ordini", column 'IDCliente' of database "dbName". 

我已经读完了这老记PHP/PDO/MSSQL how to get error informations? 和我宁愿避免额外的查询。 谢谢。

+0

请提供您的代码;如果没有它,很难说出发生了什么 – nomistic

回答

-1

我想代码并不重要,我知道sql中出了什么问题,只是想从php访问第二个代码块。

我解决了使用odbc驱动程序,而不是freetds。