Avatar of nsfranklin
nsfranklin
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Dynamic image in Crystal Subreport

Hi

I've used the process of creating a dynamic image table and adding it to a crystal report at runtime many times in vb.net, but cannot get the same principle to work in an asp.net (VB) crystal report.

Basically I have a main report which will display the data, and a sub report that will contain the report title and the dynamic image.

The main report shows the data OK, but the subreport will not display the dynamic image, I just get a blank space.

Here is my code:

Public Sub CrystalDynImage() ' As DataTable

        Dim dt As New DataTable("Images")

        Dim drow As DataRow

        'Dim ds As New DataSet

        dt.Columns.Add("img", System.Type.GetType("System.Byte[]"))

        drow = dt.NewRow()

        Dim fs As FileStream

        Dim br As BinaryReader

        fs = New FileStream(Session("logopath"), FileMode.Open)

        br = New BinaryReader(fs)

        Dim imgByte(fs.Length) As Byte

        imgByte = br.ReadBytes(Convert.ToInt32((fs.Length)))

        drow(0) = imgByte

        dt.Rows.Add(drow)

        br.Close()

        fs.Close()

        rep = New ReportDocument()

       rep.Load(Server.MapPath("installations.rpt"))

        repsub = rep.OpenSubreport("report_header.rpt")

        rep.Database.Tables(0).SetDataSource(ds.Tables("installs"))

        repsub.SetDataSource(dt)
        Session("projectreport") = rep
        Me.CrystalReportViewer1.ReportSource = Session("projectreport")
        Me.CrystalReportViewer1.DataBind()
        Me.UpdatePanel2.Update()

  End Sub

Any thoughts

Thanks
ASP.NET

Avatar of undefined
Last Comment
nsfranklin

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Éric Moreau

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
nsfranklin

ASKER
OK

Sorry I have resolved it. My code is good, but the link between the Database fields and the report was out of date.

I will award points as the link that emoreau gave reminded me to Verifiy the Databse i.e

Crystal Reports -> Database -> Verify Database, this resolved my issue.

Many thanks
Your help has saved me hundreds of hours of internet surfing.
fblack61