将多个计算的数据项,绑定在一个GridView中    select count(type1)as QTY8 from record where type1='88'and dependtype='2'
   select count(type1)as QTY7 from record where type1='87'and dependtype='2'   这样将产生多个数据集~~~将这些数据集绑定GridView,具体怎么实现~~~~谢谢~~~~(代码)

解决方案 »

  1.   

    可以把这些数据放到一个表中
    create table result
    (
    id primary key not null,
    name varchar(20),
    value int  
    )
    insert into result(name,value) select 'QTY8 ',QTY8  from (select count(type1)as QTY8 from record where type1='88'and dependtype='2')
    类似
      

  2.   

    用存储过程做,下面随手写。declare QTY8 int
    declare QTY7 int
    set QTY8 =(select count(type1)as QTY8 from record where type1='88'and dependtype='2')
    set QTY7 =(select count(type1)as QTY7 from record where type1='87'and dependtype='2')
    select QTY7 as 'QTY7',QTY8 as 'QTY8 '
      

  3.   

    select count(type1)as QTY8 from record where type1='88'and dependtype='2' 
    union
    select count(type1) from record where type1='87'and dependtype='2' 
      

  4.   

    可以先绑定一个数据集,然后预先留好其他的列,用for循环判断每一行的数据,把其他数据集的记录一个个手动绑定上去...方法貌似比较笨...不过还是可行的
      

  5.   

    这都可以,然后绑定到GridView中