多个选择语句 [英] multiple select statements

查看:79
本文介绍了多个选择语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...


我的存储过程是

Hi...


my stored procedure is

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




它在SQL中工作.但是当我在服务中使用它时,我仅获得任务价值.我无法获得任务1和任务2.我要去的地方我不能站立.还有另一种写此存储过程的方法.

在此先感谢....




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....

推荐答案

基本上,这里返回3个结果集.因此,您的应用程序必须处理结果集以具有所有这些值.例如,如果使用的是.net,则将结果集填充到DataSet对象中.该数据集将有3个DataTables,每个存储一个select语句返回的结果集,这些结果集是按照在存储过程中写入的顺序编写的.
就您而言,似乎您只是在获取第一个结果集.显示代码如何存储返回的数据,我们可能会提供帮助.
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.


这篇关于多个选择语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆