Print Page | Close Window

subreport

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=13010
Printed Date: 20 Apr 2025 at 7:31pm


Topic: subreport
Posted By: savita
Subject: subreport
Date Posted: 24 Apr 2011 at 11:45pm
I use  two diffrent datasets for main and sub report. The coding I have done is as follows. I insert a subreport in main report, also define link parameters. My problem is that subreport shows nothing but report heading. I want both main and sub reports in same page.how do I bind subreport to main report through coding. I want report as follows for each student
 
 
studentID
 
semester   ontained  total
                 marks     Marks
 
   1                75         100
   2                68         100
 
I have write query for above details as str2 filling dataset Ds1 for subreport
 
below this I want currunt semester's paper's detail like this
 
Details of Paper
----------------------
 
    Main Subject
    ---------------
          paper1
          paper2
 
    Compulsary subject
    -----------------------
          paper3
          paper4
 
This works properly in main report. shows data for details of paper
 
 
 Do anyone help me to solve my problem.
 
 
str1 = "SELECT distinct RM.*, SM.*, PM.* FROM Result_Master AS RM, Subject_Master AS SM, Pathyakram_Master AS PM " & _

" WHERE " & _

" (RM.course_code = " & Me.CmbCourse.SelectedValue & ") " & _

" AND RM.course_code = SM.course_code " & _

" AND (RM.mon_year_exam ='" & Me.CmbExamMon.Text.Trim & CmbExamYear.Text.Trim & "')" & _

" AND(RM.sem_year =" & Me.CmbExamSemYear.SelectedItem & ")" & _

" AND RM.sem_year = SM.sem_year" & _

" AND SM.paper_type =PM.pathyakram_code " & _

" ORDER BY rm.studid,rm.sem_year,pm.sr_no,Sm.paper_no"

str2 = "SELECT distinct RM.* FROM Result_Master AS RM " & _

" WHERE " & _

" (RM.course_code = " & Me.CmbCourse.SelectedValue & ") " & _

" ORDER BY rm.studid,rm.sem_year "

If RadGujarati.Checked Then

If RadFront.Checked Then

ds = GetDataSet(str)

'ds.WriteXmlSchema("e:\e2009\Examsep2008\DS_Marksheet.xsd")

pReport.Load("e:\e2009\ExamSep2008\Reports\RpTMarkSheetguj_credit_Front.rpt")

Else

ds = GetDataSet(str1)

pReport.Load("e:\e2009\ExamSep2008\Reports\RpTMarkSheetguj_credit_Back.rpt")

pReport.SetDataSource(ds)

Dim oConnection As SqlConnection = New SqlConnection(ConnStr)

Dim ds1 As New DataSet

Dim oCommand As New SqlCommand(str2, oConnection)

Dim oAdapter1 As New SqlDataAdapter(oCommand)

oAdapter1.Fill(ds1)

oConnection.Close()

'ds1 = GetDataSet(str2)

'ds.WriteXmlSchema("e:\e2009\Examsep2008\DS_Marksheet_Back.xsd")

'ds1.WriteXmlSchema("e:\e2009\Examsep2008\DS_SubMarksheet_Back.xsd")

'sReport.Item("e:\e2009\ExamSep2008\Reports\SubRpTMarkSheetguj_credit_Back.rpt").SetDataSource(ds1)

End If

ElseIf RadEnglish.Checked Then

If RadFront.Checked Then

ds = GetDataSet(str)

pReport.Load("e:\e2009\ExamSep2008\Reports\RpTMarkSheetEng_credit_Front.rpt")

Else

ds = GetDataSet(str1)

'ds1 = GetDataSet(str2)

pReport.Load("e:\e2009\ExamSep2008\Reports\RpTMarkSheetEng_credit_Back.rpt")

End If

'ElseIf RadHindi.Checked Then

'pReport.Load("e:\e2009\ExamSep2008\Reports\RpTMarkSheetHin.rpt")

End If

'pReport.Subreports.Item("sReport").SetDataSource(ds1)

orpt.ShowMe(pReport, ds, "", "")




Print Page | Close Window