Solved

Dynamic image in Crystal Subreport

Posted on 2010-09-13
2
490 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 70

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

623 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