Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Logon failed...
Message
 
À
13/02/2007 13:28:11
Information générale
Forum:
ASP.NET
Catégorie:
Rapports
Titre:
Divers
Thread ID:
01195254
Message ID:
01196154
Vues:
10
I am sorry to bother you again.. but any idea why my CR is not showing any data ?
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Create an instance of the strongly-typed DataSet
        Dim ds As New LiveDateLetter

        '----------------Live Date Letter Coordinator info-----------------
        'create table adapter
        Dim taCoordinator As New LiveDateLetterTableAdapters.lookup_liveDateLetterCoordinatorTableAdapter()
        'create data table
        Dim dtCoordinator As New LiveDateLetter.lookup_liveDateLetterCoordinatorDataTable()
        'fill data table
        taCoordinator.Fill(dtCoordinator)

        'For Each Row As LiveDateLetter.lookup_liveDateLetterCoordinatorRow In dtCoordinator
        '    Response.Write("Test data: " & Row.cLastName)
        'Next


        'create instance of CR and load the report
        Dim crLiveDateLetterPreview As New CrystalDecisions.CrystalReports.Engine.ReportDocument
        crLiveDateLetterPreview = New CrystalDecisions.CrystalReports.Engine.ReportDocument
        crLiveDateLetterPreview.Load(Server.MapPath("~\Reports\crLiveDateLetter.rpt"))


        'Routine for pushing datasets into a report object
        PushReportData(ds, crLiveDateLetterPreview)

        'set CR data source
        'crLiveDateLetterPreview.SetDataSource(ds)

        crLiveDateLetterPreview.SummaryInfo.ReportTitle = "LiveDateLetterPreview"
        crLiveDateLetterPreview.SummaryInfo.ReportAuthor = User.Identity.Name.ToString

        'bind CR to the CRViewer
        CrystalReportViewer1.ReportSource = crLiveDateLetterPreview
        CrystalReportViewer1.DataBind()

    End Sub



    Public Sub PushReportData(ByVal DsReportData As DataSet, ByVal oReport As ReportDocument)
        '   Calls SetData for the main report object
        '   Also calls SetData for any subreport objects

        Me.SetData(DsReportData, oReport)

        Dim oSubReport As ReportDocument
        For Each oSubReport In oReport.Subreports
            Me.SetData(DsReportData, oSubReport)
        Next


    End Sub


    Private Sub SetData(ByVal DsReportData As DataSet, ByVal oReport As ReportDocument)
        ' receives a DataSet and a report object (could be the 
        ' main object, could be a subreport object)

        ' loops through the report object's tables collection, 
        ' matches up the table name with the corresponding table
        ' name in the dataset, and sets the datasource accordingly

        ' This function eliminates the need for a developer to 
        ' know the specific table order in the report

        Dim oTable As Table
        For Each oTable In oReport.Database.Tables
            oTable.SetDataSource(DsReportData.Tables(oTable.Name.ToString()))
        Next

    End Sub
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform