我在vs2010中创建了一个名为“clients
”的报告,其中显示了具有以下属性的客户列表:
clientID,firstname,lastname,adres,country,birthday
我使用数据源和数据集创建了此报告。在这个数据集中,我创建了一个这样的查询:
select firstname, lastname, adres, country, birthday
from clients
这很有用!
我想添加2 optonal parameters
:
param_clientID ,param_birthDay
我想在where clausule中使用这些参数,只要它们被填充。
where clientID = param_clientID and birthday = param_birthDay
应该可以填充clientID,而不是生日参数。否则也是。
我该怎么做?
答案 0 :(得分:3)
向您报告添加(可选)参数非常简单。
首先让你的参数可以为空。
select firstname, lastname, adres, country, birthday
from clients
where (clientID = @clientID or @clientID is null)
and (birthday = @birthDay or @birthDay is null)
有关详细说明: