I have a problem while executing different resultset on the basis of parameter. I have a sp which exec two query on the basis of parameter, both queries executes once e.g.:
CREATE PROCEDURE [dbo].[ShowMessages]
@context int,
AS
BEGIN
--CALENDAR ADMIN QUEUE
if @context = 1
BEGIN
Select CustomerName, CustomerAddress from Customer
END
ELSE if @queueContext = 2 OR @queueContext = 6
BEGIN
Select EmployeeName, EmployeeAddress from Employee
END
END
===
I mapped it with my complex type: EF generates complex type with two fields CustomerName, CustomerAddress. EF throws error of IDataReader. but This error occurs rarely even i called up by first query.
How can i achieve this functionality?