Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dynamic image in Crystal Subreport

Posted on 2010-09-13
2
Medium Priority
?
492 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 1000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

722 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