Unable to display data in Subreport , VB.NET

Hi,
I am unable to display data in Subreport.

 VB.NET form is  frmSalesSummary.aspx

 Main Report  : rptSalesSummary.rpt  ( Table Name : tb_wr_sellingpoint , bind columns - sp_code, sp_name, tel_no,
                                                             sales_office_guid )

Sub Report : cr2.rpt  ( Table name : tb_wr_sellingpoint_type , bind columns - selling_pt_desc , selling_pt_type.

There is relation b/w tb_wr_sellingpoint  ( column - selling_pt_guid, foreign key ) and
                               tb_wr_selling_pt_type ( column - guid , Primary key).  

The rptSalesSummary.rpt and cr2.rpt reports are bound in frmSalesSummary.aspx form.


My problem is - The main report rptSalessummary.rpt is displaying data,
                              sub report cr2.rpt is not displaying any data. It just displaying headers of those columns I bind        
                              in  cr2.rpt.

The code was follows like below.

Plz find where I have done mistake.
I am waiting for your reply.          


Code :

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       
        'Main Report Connection Details
        conn = New SqlClient.SqlConnection("workstation id=DEV01;packet size=4096;uid=sa;password=Aut0pax;server=dev01\autopax;data source=DEV01\AUTOPAX;persist security info=False;initial catalog=webres")
        conn.Open()
        cmd = New SqlClient.SqlCommand("select sp_code,tel_no from tb_wr_sellingpoint", conn)
        cmd.ExecuteNonQuery()
        ReportDataset = New DataSet
        mainDa = New SqlClient.SqlDataAdapter(cmd)
        mainDa.Fill(ReportDataset)
        'Binding the connection details to Main Report
        rptDoc = New ReportDocument
        rptDoc.Load("C:\Inetpub\wwwroot\WebRes\Finance\General\FinancialReports\rptSalesSummary.rpt")
        For intCounter = 0 To rptDoc.Database.Tables.Count - 1
            crTable = rptDoc.Database.Tables(intCounter)
            crTableLogOnInfo.ConnectionInfo.ServerName = "SERVERNAME"
            crTableLogOnInfo.ConnectionInfo.UserID = "USERNAME"
            crTableLogOnInfo.ConnectionInfo.Password = "PASSWORD"
            crTableLogOnInfo.ConnectionInfo.DatabaseName = "DATABASENAME"
            rptDoc.Database.Tables(intCounter).ApplyLogOnInfo(crTableLogOnInfo)
        Next
        ' Sub Report
        cmd = New SqlClient.SqlCommand("select selling_pt_desc,selling_pt_type from tb_wr_sellingpoint_type", conn)
        cmd.ExecuteNonQuery()
        subReportDataset = New DataSet
        subDa = New SqlClient.SqlDataAdapter(cmd)
        subDa.Fill(subReportDataset)
        subRepDoc = New ReportDocument
        subRepDoc.Load("C:\Inetpub\wwwroot\WebRes\Finance\General\FinancialReports\rptSalesSummary.rpt")

        'Binding the connection details to Sub Report
        crTableLogOnInfo.ConnectionInfo.ServerName = "SERVERNAME"
        crTableLogOnInfo.ConnectionInfo.UserID = "USERNAME"
        crTableLogOnInfo.ConnectionInfo.Password = "PASSWORD"
        crTableLogOnInfo.ConnectionInfo.DatabaseName = "DATABASENAME"

        For index = 0 To rptDoc.ReportDefinition.Sections.Count - 1
            'Binding the connection details to Sub Report
            For intCounter = 0 To rptDoc.ReportDefinition.Sections(index).ReportObjects.Count - 1
                ' With rptDoc.ReportDefinition.Sections(index)
                If rptDoc.ReportDefinition.Sections(index).ReportObjects(intCounter).Kind = ReportObjectKind.SubreportObject Then
                    crSubreportObject = CType(rptDoc.ReportDefinition.Sections(index).ReportObjects(intCounter), CrystalDecisions.CrystalReports.Engine.SubreportObject)
                    subRepDoc = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)
                    For intCounter1 = 0 To subRepDoc.Database.Tables.Count - 1
                        subRepDoc.Database.Tables(intCounter1).ApplyLogOnInfo(crTableLogOnInfo)
                    Next
                End If
            Next
            'End With
        Next
        crTable.ApplyLogOnInfo(crTableLogOnInfo)
        subRepDoc.SetDataSource(subReportDataset)
        CrystalReportViewer2.ReportSource = rptDoc
        CrystalReportViewer2.DisplayBottomToolbar = False
        CrystalReportViewer2.DisplayGroupTree = False
        CrystalReportViewer2.DataBind()
    End Sub

Result : In frmSalesSummary, I bind rptSalesSummary.rpt ( Main Report ) , cr2.rpt ( Sub Report )
            but data was showing in rptSalesSummary.rpt, just headers of Subreport are showing, data
            was not showing in Sub report ( cr2.rpt ).

Waiting for your reply.
Thanks,
Regards

<Question editted by mlmcc PE>
<Removed database specific info like user, password>
muralii_kAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike McCrackenSenior ConsultantCommented:
Check these examples for how to pass the information
http://support.businessobjects.com/communityCS/FilesAndUpdates/vbnet_win_samples.exe.asp

I don't see anything in the code that looks incorrect but then I am not that familiar with VB.Net methods.

mlmcc

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.