Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Adding Image as a Byte[] Post Reply Post New Topic
Author Message
brendalisa
Newbie
Newbie
Avatar

Joined: 27 Oct 2010
Online Status: Offline
Posts: 4
Quote brendalisa Replybullet Topic: Adding Image as a Byte[]
    Posted: 18 Feb 2011 at 7:09pm
I'm uploading an image using this code:

Byte[] file;
using (Stream stream = dlg.OpenFile())
{
var binary = new BinaryReader(stream);
file = binary.ReadBytes((int)stream.Length);
}
return file;

And then to display it on a Crystal Report, I'm using this:

byte[] image = logo.ToArray();
var ds = new LogoDS();
DataTable t = ds.Tables.Add("Items13");
t.Columns.Add("Logo", Type.GetType("System.Byte[]"));
DataRow row = t.NewRow();
row["Logo"] = image;
t.Rows.Add(row);
report.SetDataSource(ds.Tables["Items13"]);

Then I've added this datatable to my report, and then dragged the item onto the report.

But it's not working. If I put a static image on the report, it works just fine, obviously.

Anyone see what I'm doing wrong? THANKS!
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.