如何添加 dropDownList null?

How to add dropDownList null?

我正在用 Report Builder 3.0 做报告。 有参数 dept 我把它作为一个下拉列表。 如何使默认为空,select 所有部门。

为了向 SQL 结果集添加记录,您可以使用 UNION ALL,例如:

select deptno, deptname from dept
union all
select null, 'all';

编辑:现在您的下拉列表框中有一个条目 'all',deptno 为空。根据选定的 deptno 或 null 获取数据的查询将是这样的:

select somedata
from sometable
where deptno = :chosendeptno or :chosendeptno is null;