“The active result contains no fields” using PDO with MS SQL

前端 未结 6 1299
没有蜡笔的小新
没有蜡笔的小新 2020-12-10 02:29

I am in the process of converting some old PHP pages to use PDO.

Below are two simplified queries (not my actual queries) to aid understanding of the problem I\'m ha

6条回答
  •  醉酒成梦
    2020-12-10 02:56

    If you are using a StoredProcedure and doing something as:

    DB::select("EXEC [storedprocedure] $param1,$param2;");
    

    As per above, the PDO expects the DB::select statement to return some data. But as your StoredProcedure does not return any data, you can change DB::select TO DB::update as belows:

    DB::update("EXEC [storedprocedure] $param1,$param2;");
    

    After this the error should no longer appear.

提交回复
热议问题