yii调用存储过程报错怎么办

yii调用存储过程报错怎么办,第1张

yii调用存储过程报错怎么办

yii调用存储过程报错的解决办法:首先查看“MYPROC”语句调用后抛出的异常情况;然后根据信息提示,在存储过程中添加语句为“SET NOCOUNT ON;”即可。

yii调用存储过程报错:

YII:调用MSSQL2005存储过程出现“The active result for the query contains no fields.”

推荐:《yii教程》

在用YII调用MSSQL2005的存储过程时,我需要获取返回值,利用了如下语句调用存储过程“MYPROC”:

DECLARE @return_value int; exec @return_value = MYPROC; select @return_value;

调用后抛出以下异常(用var_dump打印出来):

object(CDbException)[50]
  public 'errorInfo' => 
    array
      0 => 
string
 'IMSSP' (length=5)
      1 => 
int
 -15
      2 => 
string
 'The active result for the query contains no fields.' (length=51)
  protected 'message' => 
string

'CDbCommand 无法执行 SQL 语句:

SQLSTATE[IMSSP]: The active result for the query contains no fields.. The SQL statement executed was: DECLARE @return_value int;exec @return_value = MYPROC @ActivityID = :ActivityID ;select @return_value;' (length=257)

根据以下信息提示,我在存储过程中添加了这条语句就正常了:

SET NOCOUNT ON;

以上就是yii调用存储过程报错怎么办的详细内容,

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/700784.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-23
下一篇 2022-04-23

发表评论

登录后才能评论

评论列表(0条)

保存