This is a migrated thread and some comments may be shown as answers.

Report Book not showing data

2 Answers 122 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Levi
Top achievements
Rank 1
Levi asked on 10 Dec 2015, 03:04 PM

I have multiple reports I am trying to show in the viewer using the Report book.  I have created them in the Report Builder which produces a .trdx file.  I am able to put those in my application and when I run the page, I can see the reports placed properly but they have no data.

 

Public Function DeserializeReport(path As String) As Report
        Dim settings As New System.Xml.XmlReaderSettings()
        settings.IgnoreWhitespace = True

        Using xmlReader As System.Xml.XmlReader = System.Xml.XmlReader.Create(path, settings)
            Dim xmlSerializer As New Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
            Dim report As Telerik.Reporting.Report = DirectCast(xmlSerializer.Deserialize(xmlReader), Telerik.Reporting.Report)
            Return report
        End Using
    End Function

    Protected Sub GetCIReport()
        'Dim CIReportSource As New Telerik.Reporting.UriReportSource()
        'CIReportSource.Uri = "CONTACTINFORMATION.trdx"
        Dim sqlCIData As SqlDataSource = New SqlDataSource()
        sqlCIData.ConnectionString = "Data Source=********;Initial Catalog=AppForFinancing;Persist Security Info=True;User ID=**********;Password=*********"
        sqlCIData.SelectCommand = "SELECT * FROM ContactInformation WHERE id=1"

        CIReport.DataSource = sqlCIData
        CIReport = DeserializeReport("C:\test.trdx")
    End Sub

    Protected Sub GetAffiliationsReport()
        Dim sqlAffiliationsData As SqlDataSource = New SqlDataSource()
        sqlAffiliationsData.ConnectionString = "Data Source=DATASERVER;Initial Catalog=AppForFinancing;Persist Security Info=True;User ID=*********;Password=**********"
        sqlAffiliationsData.SelectCommand = "SELECT * FROM Affiliations WHERE id=1"

        affiliationsReport.DataSource = sqlReligiousAffiliationsData
        affiliationsReport = DeserializeReport("C:\test1.trdx")
    End Sub

 

Like I said, both reports are showing correctly, there is just no data in the reports...What am I missing???  Thanks for the help.

2 Answers, 1 is accepted

Sort by
0
Levi
Top achievements
Rank 1
answered on 10 Dec 2015, 03:08 PM

I guess I should have added this as well:

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        GetCIReport()
        GetAffiliationsReport()

        CreateReportBook()

        ReportViewer1.ReportSource = reportBook

    End Sub

Public Sub CreateReportBook()
        reportBook.Reports.Add(CIReport)
        reportBook.Reports.Add(AffiliationsReport)
End Sub

0
Nasko
Telerik team
answered on 11 Dec 2015, 02:44 PM
Hello Levi,

You are setting the value of ClReport to the report object which is returned from the DeserializeReport() method:
CIReport.DataSource = sqlCIData
CIReport = DeserializeReport("C:\test.trdx")

This will overwrite any previous modifications, such as setting the DataSource. You need to apply any changes to the report object after it has been deserialized.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Levi
Top achievements
Rank 1
Answers by
Levi
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or