Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

DYNAMIC IMAGE TO CRYSTAL REPORTS

Posted on 2006-11-13
7
Medium Priority
?
754 Views
Last Modified: 2007-12-19
I have the following code but the image is not showing in the report.

    Private mdsData As DataSet
    Private mrptDoc As New ReportDocument

    Private Sub CreateDataSet()
        mdsData = New DataSet("CardData")

        Using dt As New DataTable("CardData")
            dt.Columns.Add("Foto", System.Type.GetType("System.Byte[]"))
            dt.Columns.Add("FullName", GetType(String))
            dt.Columns.Add("NumSocio", GetType(String))
            dt.Columns.Add("TipoSocio", GetType(String))
            dt.Columns.Add("SinceDate", GetType(String))

            'Save the canadian flag into a Memory Stream object
            'and from there to an array of byte

            Dim fs As New FileStream("l:\pr.gif", FileMode.Open)   ' create a file stream
            Dim br As New BinaryReader(fs)                      ' create binary reader
            Dim row As DataRow

            ' create a new datarow
            row = dt.NewRow()

            ' set country field and image field
            row("Foto") = br.ReadBytes(br.BaseStream.Length)
            row("FullName") = "John Doe"
            row("NumSocio") = "123456"
            row("TipoSocio") = "ELITE"
            row("SinceDate") = "2/01/2002"

            ' add this row to the table
            dt.Rows.Add(row)

            ' clean up
            br = Nothing
            fs = Nothing

            mdsData.Tables.Add(dt)
        End Using

    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        CreateDataSet()
        mdsData.WriteXmlSchema(My.Computer.FileSystem.SpecialDirectories.Temp & "\CardData.xsd")
        'Load the standalone report
        mrptDoc.Load("C:\cfass\bin\Debug\reportes\rptCard.rpt")

        'Pass the dataset to the report
        mrptDoc.SetDataSource(mdsData)

        'Set the values of the parameters
        mrptDoc.SetParameterValue("BarCodeNumber", "123456")
        mrptDoc.SetParameterValue("ClubName", "CURRENT CLUB")

        'Pass the Report Document object to the viewer
        CrystalReportViewer1.ReportSource = mrptDoc
    End Sub
0
Comment
Question by:yireh
[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
  • 3
  • 3
7 Comments
 
LVL 6

Expert Comment

by:riyazthad
ID: 17931131
I think you need to use typed dataset and crystal report dynamic chat. I hope this may help you.

http://www.thescripts.com/forum/thread103039.html

Thad
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 17931826
try with a bitmap first (before trying a GIF). not all image formats are available.
0
 
LVL 1

Author Comment

by:yireh
ID: 17931964
No, the .bmp is not working.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 17932006
have you tried the sample I have in my article of October 2006 from http://emoreau.s2i.com/ ?
0
 
LVL 1

Author Comment

by:yireh
ID: 17932265
Eric, looking your sample. Your report have the image in IBlobFieldObject and my report have the image in a IFieldObject but not have the option to change the object type.
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 total points
ID: 17932404
can it be your schema that is wrong?
0
 
LVL 1

Author Comment

by:yireh
ID: 17932523
Yes,

It's working. The problem is with the schema.

Thnaks Eric.
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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

609 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