简体   繁体   English

将[value%]传递给Crystal报表中的参数

[英]passing [value%] to parameter in crystal report

dear all I tried to add query into crystal report command the query is 亲爱的,我试图将查询添加到Crystal Report命令中,查询是

Declare @FromDate Datetime
Declare @ToDate Datetime
Declare @Whse nvarchar(10)
 select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >={?@FromDate}
 select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <={?@ToDate}
select @Whse = Max(s2.Warehouse) from dbo.OINM S2 Where S2.Warehouse ='[%2]'
Select @Whse as 'Warehouse', a.Itemcode, max(a.Dscription) as ItemName,
sum(a.OpeningBalance) as OpeningBalance, sum(a.INq) as 'IN', sum(a.OUT) as OUT,
..

.. .. .. the original query is ...select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]' select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]' select @Whse = Max(s2.Warehouse) from dbo.OINM S2 Where S2.Warehouse ='[%2]' I changed '[%0] to be >={?@FromDate} (parameter) and it is work fine the same for '[%1]' now I cant change '[%2]' the only thing work with me is to change it into {?@Whse} but this give me wrong data in the report regards .. .. ..原始查询是...从dbo.OINM S0中选择@FromDate = min(S0.Docdate),其中S0.Docdate> ='[%0]'选择@ToDate = max(S1.Docdate)来自dbo.OINM s1,其中S1.Docdate <='[%1]'从dbo.OINM S2中选择@Whse = Max(s2.Warehouse),其中S2.Warehouse ='[%2]'我更改了'[%0]设置为> = {?@ FromDate}(参数),对于'[%1]'来说也可以正常工作,现在我无法更改'[%2]',唯一适用于我的方法是将其更改为{?@ se}但这给了我报告中错误的数据

I'm not clear whats are you trying to obtain from the where clause, but if you're trying to obtain those warehouse with the text: 2% you can try like?? 我不清楚您要从where子句中获取什么,但是如果您要获取包含以下文本的仓库:2%可以尝试?

Try these: 试试这些:

select @Whse = Max(s2.Warehouse) from dbo.OINM S2 Where S2.Warehouse Like '%2'

change it to 更改为

select @Whse = Max(s2.Warehouse) from dbo.OINM S2 Where S2.Warehouse ={?@select*from OWHS} 从dbo.OINM S2中选择@Whse = Max(s2.Warehouse),其中S2.Warehouse = {?@ select * from OWHS}

its work fine but for if you select more than one warehouse you will have error 它的工作正常,但如果您选择多个仓库,则会出现错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM