Part of the EllisLab Network
   
 
MS SQL Stored Procedure Call problem
Posted: 14 May 2009 03:40 AM   [ Ignore ]  
Summer Student
Total Posts:  3
Joined  07-28-2008

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'125 

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!

Profile
 
 
Posted: 28 August 2009 05:54 AM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  4
Joined  08-28-2009

I would like to know how you finally ended up with this, if you are still here around?

Profile
 
 
Posted: 12 November 2010 07:20 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Avatar
Total Posts:  25
Joined  11-01-2010

thanks

Profile
 
 
   
 
 
‹‹ Unzip      good job ››