Solved

Dynamic image in Crystal Subreport

Posted on 2010-09-13
2
480 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:nsfranklin
2 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 250 total points
ID: 33661574
Have you tried with a simple image?

check "Feeding a custom chart" from http://www.emoreau.com/Entries/Articles/2006/10/Crystal-Reports--Part-II.aspx
0
 

Author Comment

by:nsfranklin
ID: 33661676
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
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now