I have a problem with the entitry framework 6.0.0.0 when I import the stored procedure no matter what I do it does not return the result set, instead it returns only integer or set to none. below is the sp.
alter proc spGetProd
@Prod nvarchar(500)
as
begin
SET FMTONLY OFF
IF OBJECT_ID('tempdb..##PRODUCTTABLE') IS NOT NULL DROP TABLE ##PRODUCTTABLE
DECLARE @MYQUERY nvarchar(MAX), @my_Div nvarchar(500);
set @my_Div = REPLACE(@Prod, ',', ''',''');
SET @MYQUERY = 'SELECT DISTINCT [GNo],[GName]
into ##PRODUCTTABLE FROM ABC
where Div IN ('''+@my_Div+''')
order by GNo'
EXEC (@MYQUERY)
SELECT GNo, GName FROM ##PRODUCTTABLE;
drop table ##PRODUCTTABLE;
endNo matter what I do whether I set SET FMTONLY OFF / ON, NO WORK. I did it long back and it worked for one time only, when I set SET FMTONLY OFF and then removed it and it worked for that sp but for other Stored Procedures its not working. Even if I get the result set from select * from ##PRODUCTTABLE; or specify the columns like above. Here is my Action in MVC.
public JsonResult GetData()
{
var allProducts = gentity.spGetProd("AB"); //return type shows as int.
return Json(allProducts, JsonRequestBehavior.AllowGet);
}Is there any other workaround because my app is mostly dependent on the stored procedures which usually return data from temp tables like above.
Or any alternate will work for the stored procedure only, I mean without using set @MYQUERY.