我在Crystal Report中遇到问题,我需要在Crystal Report上打印,其值来自三个表:
1-teach_details 2- MasterTeacherDetails 3- MasterTeacherSpecimenDetails
所以,为此,我使用了包含所有必填字段的数据表。在Crystal Report上,Report header部分有teach_details值,详细部分是MasterTeacherDetails,然后是MasterTeacherSpecimenDetails,为此我查询为:
Select teach_details.IdentityCode,IdentityName,dbo.fun_UniIdToUniName(UniId) as UniversityName,teach_details.Address+', '+dbo.fun_CityIdToCityName(teach_details.StateID, teach_details.CityID)+', '+dbo.fun_StateIdToStateName(teach_details.StateID)+', '+teach_details.PinCode as IdentityAddress, dbo.fun_GradeIdToGradeName(teach_details.Grade) as Grade, case when teach_details.TypeOfIdentity='College' then dbo.fun_StrIdToStrName(teach_details.Streams) else case when teach_details.TypeOfIdentity='Coaching' then dbo.fun_ExamIdToExamName(teach_details.Exam) else dbo.fun_StanderdIdToStanderdName(teach_details.Standerd) end end as Strm_Exam_Standard, TeacherName+'/'+MasterTeacherDetails.TeacherCode as TeacherName, case when MasterTeacherDetails.TypeOfIdentity='College' then dbo.fun_StrIdToStrName(MasterTeacherDetails.Stream) else case when MasterTeacherDetails.TypeOfIdentity='Coaching' then dbo.fun_ExamIdToExamName(MasterTeacherDetails.Exam) else dbo.fun_StanderdIdToStanderdName(MasterTeacherDetails.Standerd) end end as TeacherStr_Exm_Stnrd, case when SameAddress='True' then teach_details.Address+', '+dbo.fun_CityIdToCityName(teach_details.StateID, teach_details.CityID)+', '+dbo.fun_StateIdToStateName(teach_details.StateID)+', '+teach_details.PinCode else MasterTeacherDetails.Address+', '+dbo.fun_CityIdToCityName(MasterTeacherDetails.StateID,MasterTeacherDetails.CityID)+', '+dbo.fun_StateIdToStateName(MasterTeacherDetails.StateID)+', '+MasterTeacherDetails.PinCode end as TeacherAddress, MasterTeacherDetails.Mobile as TeacherMobileNo,MasterTeacherDetails.EmailID as TeacherEmailID,Case MasterTeacherDetails.DOB when '01/01/1900' then '' else Convert(varchar(10),MasterTeacherDetails.DOB,103) end as DOB,MasterTeacherDetails.Remark ,BookCode,BookCode as BookName,BookCode as AuthorName,DispatchThrough as Mode,Qty from teach_details inner join MasterTeacherDetails on teach_details.IdentityCode=MasterTeacherDetails.IdentityCode inner Join MasterTeacherSpecimenDetails on MasterTeacherDetails.TeacherCode=MasterTeacherSpecimenDetails.TeacherCode where (teach_details.TypeOfIdentity ='College' and (teach_details.CityID = 'GHAZIA')) order by IdentityName
现在,问题在于MasterTeacherDetails和MasterTeacherSpecimenDetails有不同的行数,假设 MasterTeacherDetails有a,b,c和MasterTeacherSpecimenDetails有d,e,f,g,h
因此,当我使用数据运行时,它向我显示5行条目,MasterTeacherDetails行重复5次,如:
相反它应该显示:
我无法使用子报告显示标本详细信息部分和主要报告以显示教师详细信息部分。
所以请帮助,请尽量减少技术,因为我在C#.net上效率不高。
答案 0 :(得分:0)
从我通过阅读您的问题和评论收集到的内容,您似乎想要一个摘要,然后在每个教师的单独页面上都有样本列表,这样您就可以将报告分开,并将每个报告分别列出。< / p>
此外,您似乎只想使用一个SQL查询来执行此操作,这意味着一个命令表。
我将从教师分组报告的两个部分开始。
对于样本详细信息部分,您可以隐藏组页眉和页脚。使用群组专家分页设置在每个教师组之后创建新页面,以便让不同页面上的每位教师分发报告的各个部分。此外,您可能希望在此组之后重新开始页码。我不认为你可以通过小组专家来做到这一点;您可能需要通过组页脚分页设置的部分专家来完成此操作。
对于教师详细信息部分,还可以使用教师分组来显示教师详细信息&#34;在组页眉或页脚中,然后使用节专家抑制详细信息部分。这将消除您的多行。我会将教师详细信息放在报告标题部分的子报告中,并使用部分专家在报告标题部分之后创建新页面。这就像一个专门的头版。
答案 1 :(得分:0)
请改用DataSet
DataSet dsReport = new DataSet();
dsReport.Tables.Add(dataTable1);
dsReport.Tables.Add(dataTable2);
yourReport.SetDataSource(dsReport)