具有不同表的存储过程和Crystal Reports [英] Stored Procedures and Crystal Reports with different tables

查看:169
本文介绍了具有不同表的存储过程和Crystal Reports的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用存储过程运行带有四个不同表的水晶报表.存储过程中的select语句如下:

I am running a crystal report with four different tables using a stored procedure. The select statement in the Stored Procedured is as follows:

SELECT DISTINCT [tblWHOModelEML].[ActiveIngredient]
		  ,[tblWHOModelEML].[Strength]
          ,[DosageFormRoute]
		  ,[tblWHOATCLevelTwoCodDescrpt].[ATCLevelTwoDescript]
		  ,[tblWHOATCLevelOneCodeDescript].ATCLevelOneDescript
           FROM [dbo].[tblWHOModelEML] LEFT OUTER JOIN [dbo].[tblMCAZ_Approved] ON [dbo].[tblWHOModelEML].[EMLCode] = [dbo].[tblMCAZ_Approved].[EMLCode] INNER JOIN [dbo].[tblWHOATCLevelTwoCodDescrpt] ON [dbo].[tblWHOModelEML].[ATCLevelTwoCode] = [dbo].[tblWHOATCLevelTwoCodDescrpt].[ATCLevelTwoCode] INNER JOIN tblWHOATCLevelOneCodeDescript ON tblWHOModelEML.ATCLevelOneCode = tblWHOATCLevelOneCodeDescript.ATCLevelOneCode
	       WHERE NOT EXISTS (SELECT [dbo].[tblMCAZ_Approved].[ActiveIngredient], [dbo].[tblMCAZ_Approved].[Strength], [dbo].[tblMCAZ_Approved].[DosageForm] FROM [dbo].[tblMCAZ_Approved] WHERE [dbo].[tblWHOModelEML].[EMLCode] = [dbo].[tblMCAZ_Approved].[EMLCode]) 
	       ---AND [tblMCAZ_Approved].[Applicant] Like '%@ApplicantName%' 
		   ORDER BY ActiveIngredient


我已经注释掉了"AND",它应该使用特定的选定Aplicant进一步过滤结果集,因为它不起作用.任何人都可以协助我在上面的SQL语句中包括Applicant LIKE语句,以使其起作用.有人建议使用子查询,对此我一无所知.

问候.

克里斯


I have commented out the "AND" which was supposed to further filter the result set using a particular selected Aplicant as this is not working. Can anyone assist me in including this where Applicant LIKE statement into the above SQL statement to make it work. Someone was suggesting use of subqueries and I am blank on this.

Regards.

Chris

推荐答案

1.在存储过程中将ApplicationName用作参数.
2.在Crystal报表中,创建一个Report参数,并将其作为参数值传递给Storedprocedure.

因此,当生成报告时,此值将传递到storedprocedure,结果将被进一步过滤.
1. Make ApplicationName as the parameter in your storedprocedure.
2. In the crystal reports create a Report parameter and pass this as parameter value to Storedprocedure.

So when the report is generated this value is passed to storedprocedure and the result will be further filtered.


Hello Chris
我没有立即提供样品.以下链接
http://www.c-sharpcorner. com/UploadFile/Yoyi/passparameterstoreport09202005005343AM/passparameterstoreport.aspx?ArticleID = 5b9f2758-d3a3-4a77-9ef1-e3bf7044500d [加载在C#中使用Stored Proc的Crystal Report报表 [^ ]

应该可以帮到你.

基兰(Kiran)
Hello Chris
I don''t have a sample available immediately. The following links
http://www.c-sharpcorner.com/UploadFile/Yoyi/passparameterstoreport09202005005343AM/passparameterstoreport.aspx?ArticleID=5b9f2758-d3a3-4a77-9ef1-e3bf7044500d[^]

Loading Crystal Report reports which use Stored Proc in C#[^]

should help you out.

Kiran


这篇关于具有不同表的存储过程和Crystal Reports的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆