我正在尝试各种可能性,但仍然在codeigniter中清空输出。 我在SQL Server中执行所有查询,它不适合我
sp_detail_report XX64,'2018-01-01','2018-02-01',0,1
EXEC sp_detail_report XX64,'2018-01-01','2018-02-01',0,1
EXECUTE sp_detail_report XX64,'2018-01-01','2018-02-01',0,1
EXEC sp_detail_report @appl = 'XX64',@StartDate = '2018-01-01',@EndDate = '2018-02-01',@List = 0,@State = 1
sp_detail_report {XX64},{'2018-01-01'},{'2018-02-01'},{0},{1}
这个控制器
public function detail_report_sp()
{
$query = $this->Report_model->tbl_detail_report_sp2();
$exec = $query->result();
var_dump($exec);
print_r($exec);
}
这是我的模特
public function tbl_detail_report_sp2()
{
$otherdb = $this->load->database('otherdb', TRUE);
$data = " EXEC sp_detail_report XX64,'2018-01-01','2018-02-01',0,1; ";
$sql = $otherdb->query($data);
return $sql;
}
始终输出错误
Message: Call to a member function result_array() on boolean
或
object(CI_DB_sqlsrv_result)[21]
public 'scrollable' => string 'buffered' (length=8)
public 'conn_id' => resource(49, SQL Server Connection)
public 'result_id' => resource(51, SQL Server Statement)
public 'result_array' =>
array (size=0)
empty
public 'result_object' =>
array (size=0)
empty
public 'custom_result_object' =>
array (size=0)
empty
public 'current_row' => int 0
public 'num_rows' => null
public 'row_data' => null
Array ( )
总是空着的。
你知道解决方案吗?非常感谢你
答案 0 :(得分:0)
解决的。
我修复了商店程序
我把SET NOCOUNT打开;
在每个BEGIN之后
BEGIN
SET NOCOUNT ON