Mssql: Show Errors

Hi all,

I have a query to a MSSQL server that fails, but no error message is shown.

All other PHP errors are shown.

Does anyone know how I can display all mssql error messages? Or access the error message from my recent query?

I am using following connection string:


'connectionString' => 'dblib:host=0.0.0.1;dbname=mydb;charset=UTF-8',

Here is my code:


$connection = Yii::app()->db;

$sql = "

   SELECT TOP 30

      bz.Article_ID,

   FROM

      dbo.TableXYZ AS bz // Should show a error message, because TableXYZ is not there.

";	


$command = $connection->createCommand($sql);

$connection->errorInfo();


$rows = $command->queryAll();	

Regards

ycast

check if connection string is ok

http://www.yiiframework.com/wiki/192/config-use-ms-sql-server-2005-2008/

also check the logs file in protected/runtime folder

Thanks KonApaz, my connection string is fine. And my log files only show php errors…

If I change dbo.TableXYZ to a table that exists, results show as expected. Just no error messages when my sql is wrong.

Did you modify an confuguration file of Yii (or sqlserver) ?

In my case the mysql errors displayed.

$connection = Yii::app()->db;

$sql = "SELECT TOP 30 bz.Article_ID FROM dbo.TableXYZ AS bz TableXYZ";

$command = $connection->createCommand($sql);

$rows = $command->queryAll();

check with a tested mysql database if the errors displayed and let me know

MySQL errors are shown. So I guess it’s likely the configuration of the MSSQL server. Any thoughts where I could start looking?

which version of Yii you have?

also check the version of sql server

also check

‘db’=>array(

                        'connectionString' => 'dblib:host=0.0.0.1;dbname=mydb;charset=UTF-8',


                         'emulatePrepare' => [color="#FF0000"]false, OR true OR remove this line entirely[/color]


                        'username' => '...',


                        'password' => '...',


                        'charset' => 'utf8',


                    ),

finaly make your own php code to check if the problem exist on PDO php or your sqlserver

http://msdn.microsoft.com/en-us/library/ff628154(v=sql.105).aspx