1

我在报告生成器 3 中遇到 SSRS 报告问题。我正在尝试使用一个参数来显示文本而不是字段的 int 数据类型。每次我尝试预览报表时,报表生成器都会吐出一个错误。我已经尝试转换和转换数据类型,但仍然得到同样的错误。任何见解将不胜感激。以下是参数来源的查询和错误消息。

- 询问

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
4

2 回答 2

0

首先添加参数并将其类型设置为文本并检查多个值,如下所示

在此处输入图像描述

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

在此处输入图像描述

于 2013-09-13T14:48:34.740 回答
-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
于 2013-09-16T16:21:06.410 回答