Hi there!!!
I have a bit of a problem with a call to a stored procedure using the ms sql database. I am very new to CI and am trying it out but got stuck big time at this issue.
My stored procedure does a paging action returning the pages base on parameters. When I run the following through a SQL Query Analyzer (directly in the MS SQL gui) it works like a charm:
EXEC returnpage ' select (select count(*) from er_oe_incomplete_orders) as counted, * from er_oe_incomplete_orders ', 'ordnumber ASC', 1, 25
In other words it returns the rows as required.
however when I try to return it through CI with the following code:
$strSql = "EXEC
returnpage '
select
(select count(*) from $dbname) as counted,
*
from
$dbname
', 'ordnumber ASC', $pagenumber, $pagesize
";
$result = $this->db->query($strSql);
It gives me the following error:
A Database Error Occurred
Error Number:
EXEC returnpage ’ select (select count(*) from er_oe_incomplete_orders) as counted, * from er_oe_incomplete_orders ‘, ‘ordnumber ASC’, 1, 25
I have tried many things shown here in the forums, bu without success. They all gave me the same error. I can run SQL queries through the normal Select * From Tablename, but I need to use the stored procedure which returns a record set.
Could anyone please help me by providing me with the right coding, because I have spent close to 5 days on this issue, and am so ready to give in hahahahaha!
I thank you in advance, and looking forward to using this framework: really well coded. Thank you guys!
