SSRS报告 - 套管参数

时间:2013-09-13 13:42:09

标签: sql sql-server reporting-services ssrs-2008

我在“报表”构建器3中遇到SSRS报表的问题。我正在尝试使用一个参数来填充文本而不是字段的int数据类型。每次我尝试预览报表时,Report Builder都会发出错误。我已经尝试过转换和转换数据类型,但仍然会得到相同的错误。任何见解都会非常感激。以下是参数的来源查询和错误消息。

- 查询

select distinct case convert(varchar(10),workorderstatusid)
when '1' then 'Open'
when '2' then 'Closed'
when '105' then 'OnHold'
when '101' then 'Cancelled'
end  as 'Status'
from tasks

- 错误消息

Cannot read the next data row for the dataset DataSet1. (rsErrorReadingNextDataRow)
----------------------------
An error has occurred during report processing. (rsProcessingAborted)

- 数据集1 - 主要查询

select wo_num as 'Word Order ID',isnull(dept,'Unassigned') as 'Department', 
task as 'Summary', isnull(descript, 'No Description') as 'Notes', 
respons as 'Assigned Technician', duedate as 'Due Date',completed as 'Date Completed',
isnull(status,'Incomplete') as 'Status'
from tasks
where (workorderstatusid =@status)
and (dept=@department)
order by wo_num asc

2 个答案:

答案 0 :(得分:0)

首先添加参数并将其设置为Text,并将多个值设置为

enter image description here

然后设置默认值以通过查询设置并选择数据集

enter image description here

答案 1 :(得分:-1)

想出来的人,需要在主要查询之前包含这个陈述

if (@status = 'Open')
begin 
      set @status = 1
end
else if (@status = 'Closed')
Begin
      set @status = 2
End
else if (@status = 'OnHold')
Begin
      set @status = 105
End
else if (@status = 'Cancelled')
Begin
      set @status = 101
End