在crystal报告中传递参数sql命令查询

时间:2012-01-25 19:44:50

标签: crystal-reports

我正在尝试在Crystal报表中向SQL命令添加一个参数,但它出错了。以下是我的查询

select r.ID as ActivityRequestID, count(c.ID) as ChangeCount from Change c join ActivityRequest r on c.ObjID=r.ID 
where (c.Class='ActivityRequest' and c.ChangeType='Modified' and (c.PropertyName='Definition' or c.PropertyName='Registration') and ({c.Performed} >={?ChangesSince} ) ) group by r.ID

我去了数据库专家并创建了上面的命令。现在,当我尝试保存命令时,它会给我错误。 '无法从数据库中检索数据。没有给出一个或多个参数的值'。现在,用户在报告加载时选择参数,并且没有我可以提供的硬编码值。请告诉我解决上述问题的方法。

1 个答案:

答案 0 :(得分:4)

我认为你无意中包含了几个不需要的括号,{c.performed}左右 - 试试这个:

select r.ID as ActivityRequestID, 
       count(c.ID) as ChangeCount 
from Change c 
join ActivityRequest r on c.ObjID=r.ID 
where c.Class='ActivityRequest' and 
      c.ChangeType='Modified' and 
      (c.PropertyName='Definition' or 
       c.PropertyName='Registration') and 
      c.Performed >={?ChangesSince}  
group by r.ID