Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Assigning Image to Crystal Report at run time Post Reply Post New Topic
Author Message
vinuthak
Newbie
Newbie


Joined: 10 Jul 2008
Online Status: Offline
Posts: 2
Quote vinuthak Replybullet Topic: Assigning Image to Crystal Report at run time
    Posted: 14 Jul 2008 at 1:41am
Hi,
 
I have requirement to assign Image to Crystal Report at run time.
I datasource for the reports is dataset.
 
So I created a Datatable having column of type System.Byte[],
i used the below code.

DataTable dtImage = new DataTable("Image");

dtImage.Columns.Add("Img", Type.GetType("System.Byte[]"));
string strFileName = "Image.JPG";
 
if (strFileName != "" && File.Exists(strFileName))
{

FileStream fsStream = new FileStream(strFileName, FileMode.Open);

BinaryReader brReader = new BinaryReader(fsStream);

DataRow drRow = dtImage.NewRow();

drRow[0] = brReader.ReadBytes(Convert.ToInt32(brReader.BaseStream.Length));

dtImage.Rows.Add(drRow);

fsStream.Close();

fsStream.Dispose();

fsStream = null;

brReader = null;

}

when i try assigning dtImage as the datasource to reports,i dont see any assignment of new iMage,
Am i missing anything in the code.
 
Regards
Vinutha
 
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.