I have 3 tables, Trainees, Attendance and Grades.
I want to display the attendance report of trainee in the first part of the report (Top) and Grades on the second part (bottom). Please help, how can i do it? thank you in advance. Here's my code.
NOte: the error is in the
cr.Subreports = cr2
subreports is read only
What I have tried:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Try
If con.State = ConnectionState.Open Then
con.Close()
End If
con.Open()
Dim sql As String
Dim prn As String = ComboBox2.Text
Sql = "SELECT dbo.Trainees.Name, dbo.Trainees.GroupName, dbo.Trainees.IDPic, dbo.Trainees.AName, dbo.FollowUp.prno, " +
" dbo.FollowUp.cycleno, dbo.FollowUp.mo, dbo.FollowUp.dy, dbo.FollowUp.yr, dbo.FollowUp.code, " +
" dbo.FollowUp.warnings, dbo.FollowUp.wcategory, dbo.FollowUp.wreason, dbo.FollowUp.A, dbo.FollowUp.B, " +
" dbo.FollowUp.P, dbo.FollowUp.C, dbo.FollowUp.Q, dbo.FollowUp.L, dbo.FollowUp.V, dbo.FollowUp.S, dbo.FollowUp.totalhrs " +
" From dbo.Trainees INNER Join dbo.FollowUp ON dbo.Trainees.PRNo = dbo.FollowUp.prno " +
" Where(dbo.FollowUp.prno = '" + prn + "') "
Dim da As New System.Data.SqlClient.SqlDataAdapter(Sql, con)
Dim ds As New DataSet8
da.Fill(ds, "View_8")
Dim cr As New CrystalReport10()
cr.SetDataSource(ds)
Dim sql2 As String
sql2 = "SELECT dbo.Grades.PRNo, dbo.Trainees.Name, dbo.Grades.CycleNo, dbo.Grades.Results, dbo.Grades.Remarks " +
" FROM dbo.Trainees INNER JOIN dbo.Grades ON dbo.Trainees.PRNo = dbo.Grades.PRNo " +
" WHERE(dbo.Grades.PRNo = '" + prn + "') "
Dim da2 As New System.Data.SqlClient.SqlDataAdapter(sql2, con)
Dim ds2 As New DataSet16
da2.Fill(ds2, "View_16")
Dim cr2 As New CrystalReport55()
cr2.SetDataSource(ds2)
CrystalReportViewer1.ReportSource = cr
cr.Subreports = cr2
Catch ex As Exception
MsgBox(ex.Message)
con.Close()
End Try
con.Close()
End Sub