我用的是VS2008里的RDLC报表...
有一张页面需要显示的列,因为比较麻烦是时间段累加的一张报表,我都通过存储过程整理好了,只需要传一些参数就可以了.
问题:
在数据集创建DateSet的时候 却找不到这个存储过程.
步骤如下:我把MicrosoftReportViewer拖到WinForm窗体里
2.选择设计新报表
3.添加数据源
4.选择数据库,下一步,下一步
5.选择存储过程,在这步里我能看到我在数据库里写的存储过程selectib
6.我选择完成,返回选择数据源 新建的DateSet1里就没有我刚选的selectib,我想可能是这个存储过程是虚拟的...但是报表里怎么使用它呢?---------------谢谢各位大哥帮忙下我原本想就算不使用它 ,我复制一张报表出来,在代码里给他数据集等等就可以了..但是报表预览的时候就不通过,好象是必须要设定的..请大家给点路子.谢谢了

解决方案 »

  1.   

    up一下.大家帮帮忙..谢谢了...
    补充一下.我的存储过程里Create Table了一张虚表..因为对RDLC的一些规则和语法都不太懂.所以请教下大师傅...
    存储过程如下.整理后样子
        a        b   c  d  ....
    时间-时间     2   3  4....
    ...
    -----------------------CREATE PROCEDURE dbo.rdlc
       @fromdate datetime,    --报表需要统计的数据的开始时间,如果统计时段小于1天,则需要协商分钟,类似:2008-01-01 01:30
       @enddate datetime,    ----报表需要统计的数据的结束时间
       @incstep varchar(10) --统计时段类型,值:1M,1W,1D,1H,30MI,15MI
    AS
       DECLARE @currFrom datetime   --当前统计时段的开始时间
       DECLARE @currEnd datetime    --当前统计时段的结束时间
    set @currFrom=@fromdate--创建临时表, 处理时间段
    Create Table #QeryData(io  INT, agentgrp int,AnswerFlag int, QueueDuration int ,WaitTime int,StartRingTime datetime,TalkDuration int,InboundCallTime DATETIME, DATE_PART VARCHAR(50))
    WHILE @enddate > @currFrom
    BEGIN
    if (@incstep='1M') set @currEnd = DATEADD(Month, 1, @currFrom)  --按月
    if (@incstep='1W') set @currEnd = DATEADD(Week, 1, @currFrom)  --按星期
    if (@incstep='1D') set @currEnd = DATEADD(Day, 1, @currFrom)  --按天
    if (@incstep='60m') set @currEnd = DATEADD(Hour, 1, @currFrom)  --按小时
    if (@incstep='30m') set @currEnd = DATEADD(minute, 30, @currFrom)  --按半小时
    if (@incstep='15m') set @currEnd = DATEADD(minute, 15, @currFrom)  --按15分钟
    begin
    INSERT into #QeryData
    SELECT  io,agentgrp,AnswerFlag,QueueDuration,WaitTime,StartRingTime,TalkDuration,
     InboundCallTime,
    left(convert(varchar, @currFrom,120),16)+' - '+ left(convert(varchar, @currEnd,120),16) 
                   AS DATE_PART
    FROM calllog
    WHERE (io=0) and InboundCallTime>=@currFrom and InboundCallTime<@currEnd order by InboundCallTime
    end
    INSERT into #QeryData values(0, 100, 0, 0,0, 0, 0, 0,  left(convert(varchar, @currFrom,120),16)+' - '+ left(convert(varchar, @currEnd,120),16) )
    set @currFrom = @currEnd  --进入下一阶段
    ENDselect DATE_PART, sum(f1) as 'a', sum(f2) as 'b', sum(f3) as 'c', sum(f4) as 'd', sum(f5) as 'e', sum(f6) as 'f', sum(f7) as 'g' , sum(f8) as 'h'
     from(
    --呼入总量
    select DATE_PART, count(DATE_PART)  as f1, 0 as f2, 0 as f3, 0 as f4, 0 as f5, 0 as f6, 0 as f7,0 as f8
    from #QeryData 
    group by DATE_PART
    --order by DATE_PARTUNION
    --通话总时常
    select  DATE_PART, 0, sum(TalkDuration), 0, 0, 0,0, 0,0
    from #QeryData 
    where TalkDuration>0
    group by DATE_PARTUNION
    --排队总时常
    select   DATE_PART, 0, 0, sum(QueueDuration), 0, 0,0, 0,0
    from #QeryData 
    where QueueDuration>0 and answerflag=1
    group by DATE_PARTUNION
    --排队总时常2
    select   DATE_PART, 0, 0, 0, 0,0, 0,0,sum(QueueDuration)
    from #QeryData 
    where QueueDuration>0 and answerflag=0
    group by DATE_PART
    UNION
    --转人工总数
    select  DATE_PART, 0, 0, 0, count(DATE_PART) ,0,0, 0,0
    from #QeryData 
    where agentgrp is not null and agentgrp<>100
    group by DATE_PART
    UNION
    --人工接通总数
    select DATE_PART, 0, 0, 0, 0, count(DATE_PART) ,0, 0,0
    from #QeryData 
    where agentgrp is not null and AnswerFlag=1
    group by DATE_PART
    UNION
    --20秒内放弃量
    select ss.DATE_PART,0,0,0,0,0, count(ss.DATE_PART),0,0
    from (
    select AnswerFlag,QueueDuration,WaitTime,StartRingTime,DATE_PART 
    from #QeryData 
    where AnswerFlag=0 and StartRingTime is  null and (isnull(QueueDuration,0)+isnull(WaitTime,0))<=20 and QueueDuration is not null
    ) ss
    group by DATE_PART
    UNION
    --20秒后放弃量
    select ss.DATE_PART,0,0,0,0,0, 0, count(ss.DATE_PART),0
    from (
    select AnswerFlag,QueueDuration,WaitTime,StartRingTime,DATE_PART 
    from #QeryData 
    where AnswerFlag=0 and StartRingTime is  null and (isnull(QueueDuration,0)+isnull(WaitTime,0))>20 and QueueDuration is not null
    ) ss
    group by DATE_PART
    )sss
    group by DATE_PART
    /**/
    GO
      

  2.   

    参考:
    http://blog.csdn.net/taomanman/archive/2010/06/01/5640319.aspx 以前做的,用的也是存储过程,看看对你可有帮助