从 iReport 调用 MSSQL 存储过程
我想从 iReport 调用 MSSQL 服务器中的存储过程。
查询:
SET QUOTED_IDENTIFIER OFF
SET DATEFORMAT mdy
Exec SP_SAMPLE '12-jan-2008', '12-jul-2011',
"$P!{Param1}",
"$P!{Param2}",
1,
"$P!{Param3}"
SET QUOTED_IDENTIFIER ON
Where,
Param1 = 'A436F3A9-6A8B-40C4-B38E-567B05522449',
'4DD40BC2-3390-4B1B-8841- 483A8FDAB2FD',
'B95E8F04-6EE7-4BC6-BDD0-F95C4AFDAC0B',
'AE757961-0E25-41B8-A382- 7600DDA0ABC7',
'90B9CC0C-6090-4CEF-8BC9-9C8EA3C0F63C',
'1E191B19-13D0-4CE2-B1EC- 3CFF9316887F',
'A9EE7AE9-435C-4164-96F5-3DB20A6321BE',
'DCD6D045-8B42-4B83-8C97-21EE9DFF644C'
Param2 = '4E6E8464-F08A-4BB8-950F-38908E4E7B30',
'76EBA40E-F898-4541-9208-8A6B3A35E082',
'7C64DA92-C168-4A74-8955-F1974258AD12',
'2E6DDC25-E037-4842-9E7F-2B9586561744'
Param3 = 3EC43FB7-F258-4441-8188-A55E7BD40ADE
请注意,存储过程param1
、param2
、param3
在sqlserver中是文本数据类型。而在 iReport 中我将它们作为一个集合。
谁能告诉我如何在 iReport 中生成上述带双引号的查询?
另外,运行 iReport 时有没有办法显示带有填充参数值的查询?
I want to call an stored procedure in an MSSQL server from iReport.
Query:
SET QUOTED_IDENTIFIER OFF
SET DATEFORMAT mdy
Exec SP_SAMPLE '12-jan-2008', '12-jul-2011',
"$P!{Param1}",
"$P!{Param2}",
1,
"$P!{Param3}"
SET QUOTED_IDENTIFIER ON
Where,
Param1 = 'A436F3A9-6A8B-40C4-B38E-567B05522449',
'4DD40BC2-3390-4B1B-8841- 483A8FDAB2FD',
'B95E8F04-6EE7-4BC6-BDD0-F95C4AFDAC0B',
'AE757961-0E25-41B8-A382- 7600DDA0ABC7',
'90B9CC0C-6090-4CEF-8BC9-9C8EA3C0F63C',
'1E191B19-13D0-4CE2-B1EC- 3CFF9316887F',
'A9EE7AE9-435C-4164-96F5-3DB20A6321BE',
'DCD6D045-8B42-4B83-8C97-21EE9DFF644C'
Param2 = '4E6E8464-F08A-4BB8-950F-38908E4E7B30',
'76EBA40E-F898-4541-9208-8A6B3A35E082',
'7C64DA92-C168-4A74-8955-F1974258AD12',
'2E6DDC25-E037-4842-9E7F-2B9586561744'
Param3 = 3EC43FB7-F258-4441-8188-A55E7BD40ADE
Note that stored procedures param1
, param2
, param3
are of text datatype in sqlserver. Whereas in iReport I made them a collection.
Could any one tell me how can I generate the above query in iReport with the double quotes?
Also, Is there any way to display the query with filled parameter values when running iReport?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Jasper Reports 使用两种类型的参数进行操作:$P{name_parameter} 和 $P!{name_parameter}。
你用的是$P!查询中的参数使您可以完全控制构建查询。
示例:
如果:
查询结果将是:
在 IReport 4.1 中,您可以在输出控制台(iReport 输出窗口)中查看结果查询。
您可以设置 log4j.properties 以查看自定义 java 应用程序的结果查询。
Jasper Reports operates with two types of parameters: $P{name_parameter} and $P!{name_parameter}.
You using $P! parameter in query that give you full control on building query.
Example:
If:
the result query will be:
In IReport 4.1 you can view resulting query in output console (iReport output window).
You can set log4j.properties to see result query for custom java application.