Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi...


my stored procedure is

SQL
select count(TaskId) as tasks from Task T,Provider P  where P.UserId=T.UserId  and T.permissions='False' and T.State='Close' and T.Assignedto=@Assignedto


select count(TaskId) as tasks1 from Task T,Provider P where P.UserId=T.UserId  and T.Permissions='False' and T.State='Open' and T.Assignedto=@Assignedto



select count(TaskId) as tasks2 from Task T,Provider P where P.UserId=T.UserId  and T.Permissions='False' and T.State='Completed' and T.Assignedto=@Assignedto



it is working in sql. but when i am using it in services i am getting only tasks value.i can't get tasks1 and tasks2. where i am going i cant under stand. is there another way to write this stored procedure.

thanks in advance....
Posted

1 solution

Basically there are 3 result sets that are returned here. So it's your application that has to handle the result-sets to have all these values. For example, if you are using .net, you will fill the result set in a DataSet object. This dataset will have 3 DataTables each storing one result set returned by select statements in the order it is written in the stored procedure.

In your case, it seems you are just taking the first result set. Show the code how you are storing the data returned, and we might help.
 
Share this answer
 
Comments
07405 5-Nov-12 7:22am    
i wrote wcf services. when i am updating stored procedure to create complex type it is showing only tasks not tasks1 and tasks 2
Ankur\m/ 5-Nov-12 8:26am    
I have already tried to reply to that. It's the way you are consuming the data. You will have to show your code for any further help.
The other option is to combine the query to return just one result set rather than 3.

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