error in sub-report in crystal report

BrOkEn_iCe

New member
Joined
Mar 27, 2012
Messages
2
Programming Experience
3-5
hi all i have problem in sub-report

i made a CrystalReport2.rpt that have a sub-report CrystalReport3.rpt

but when i use vb.net project to show the report it keep the subreport without data

see the pic below




and i use that code to fill data



VB.NET:
        Dim rpt As New CrystalReport2()
        Dim rpt2 As New CrystalReport3()
        Dim sqls As String


        Dim sql2 As String








        If con Is Nothing OrElse con.State = ConnectionState.Closed Then
            'MsgBox("closed")
            OpenCon()
        End If








        sqls = "SELECT     qr_data.qr_date, qr_data.st_id, qr_data.qr_time, qr_data.qr_sub_user, qr_data.qr_other_user, qr_data.qr_comment, Station.st_name, " & _
                     " city.city_id, city.city_name, company.comp_id, company.comp_name, 'محمد' AS qr_user, qr_main.main_v_id, Question_main.main_v_name, " & _
                     " qr_main.main_value" & _
                     " FROM Question_main INNER JOIN" & _
                     " qr_main ON Question_main.main_v_id = qr_main.main_v_id RIGHT OUTER JOIN" & _
                     " qr_data INNER JOIN " & _
                     " Station ON qr_data.st_id = Station.st_id INNER JOIN" & _
                     " city ON Station.city_id = city.city_id INNER JOIN" & _
                     " company ON city.comp_id = company.comp_id ON qr_main.qr_date = qr_data.qr_date AND qr_main.st_id = qr_data.st_id" & _
                     " WHERE ( qr_data.st_id = " & cbstation.SelectedValue & ") AND (qr_data.qr_date =  CONVERT(DATE, '" & dtdate.Value.Date & "'))"














        sql2 = "SELECT     a.qr_date, a.st_id, a.qr5, a.CountAll, a.sumAll, b.countTrue, b.sumTrue" & _
" FROM         (SELECT     dbo.qr_value.qr_date, dbo.qr_value.st_id, SUBSTRING(RTRIM(LTRIM(STR(dbo.qr_value.qr_id))), 1, 5) AS qr5, COUNT(dbo.qr_value.qr_value) AS CountAll, " & _
                                             " SUM(dbo.Questionnaire.degree) AS sumAll" & _
                      "  FROM         dbo.qr_value INNER JOIN" & _
                                            "  dbo.Questionnaire ON dbo.qr_value.qr_id = dbo.Questionnaire.qr_id" & _
                       " GROUP BY dbo.qr_value.qr_date, dbo.qr_value.st_id, SUBSTRING(RTRIM(LTRIM(STR(dbo.qr_value.qr_id))), 1, 5)" & _
                      "  HAVING      (dbo.qr_value.st_id = 10201) AND (dbo.qr_value.qr_date = CONVERT(DATE, '2012-04-23'))) AS a LEFT OUTER JOIN" & _
                        "  (SELECT     qr_value_1.qr_date, qr_value_1.st_id, SUBSTRING(RTRIM(LTRIM(STR(qr_value_1.qr_id))), 1, 5) AS qr5, COUNT(qr_value_1.qr_value) AS countTrue, " & _
                                                  " SUM(Questionnaire_1.degree) AS sumTrue" & _
                            " FROM         dbo.qr_value AS qr_value_1 INNER JOIN" & _
                                                 "  dbo.Questionnaire AS Questionnaire_1 ON qr_value_1.qr_id = Questionnaire_1.qr_id" & _
                            " GROUP BY qr_value_1.qr_date, qr_value_1.st_id, SUBSTRING(RTRIM(LTRIM(STR(qr_value_1.qr_id))), 1, 5), qr_value_1.qr_value" & _
                            " HAVING      (qr_value_1.qr_value = 1) AND (qr_value_1.st_id = 10201) AND (qr_value_1.qr_date = CONVERT(DATE, '2012-04-23'))) AS b ON " & _
                   "   a.qr_date = b.qr_date AND a.st_id = b.st_id AND a.qr5 = b.qr5"




        Dim dscmd2 As New SqlDataAdapter(sql2, con)
        Dim ds2 As New DataSet2


        dscmd2.Fill(ds2, "report2")


        rpt2.SetDataSource(ds2.Tables("report2"))


        Dim dscmd As New SqlDataAdapter(sqls, con)
        Dim ds As New DataSet2
            dscmd.Fill(ds, "report1")
        rpt.SetDataSource(ds.Tables("report1"))






        CrystalReportViewer1.ReportSource = rpt
            CrystalReportViewer1.Refresh()




        con.Close()





if i use CrystalReport3 direct it show data if i show it in subreport it don't show any thing


what i make wrong


and thx for the help
 
Back
Top