Click here to Skip to main content
15,894,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
I am getting this error
"The data reader returned by the store data provider does not have enough columns for the query requested."

SQL
alter Procedure  [dbo].[P_poll_Get_checkpolluser]
( 
   @user      varchar(100),
   @Result    int output
)
   AS
Begin
	 SELECT @Result=Count(*)  from
						( SELECT  FCourseExeID
							 from VDB_CoursRegisterAll   
								where FUserName=@user and FMark >= FMinmark   and  FCourseExeID	  in(select FCourseExeID from [dbo].[TEvalSetting] where FISEnabled =1) 
							 EXCEPT
						SELECT  FCourseExeID
							 from [dbo].[TEvalScores]
							where FUserName=@user  ) as k
							
			 
RETURN  @Result
end


C#
  using (Hrst context = new Hrst())
                {
                    ObjectParameter parameter = new ObjectParameter("Result", typeof(int?));
                    var q = context.P_poll_Get_checkpolluser(user, parameter).First();
                 
                    if(Convert.ToInt32(parameter.Value.ToString()) > 0)
                    {}
}
Posted
Updated 5-Dec-14 20:11pm
v2
Comments
/\jmot 6-Dec-14 3:07am    
for which one you getting this error??

1 solution

Entity framework does not support scalar return from a stored procedure out of the box.
But try to exchange the second last line in the SP from RETURN @Result to SELECT @Result
 
Share this answer
 
v2
Comments
Maciej Los 14-Dec-14 13:06pm    
+5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900