HI there.. I'm also having trouble with images in crystal reports for ASP.Net 2005. I have a web appication with crystal report. The report must have a dynamic logo. This image files will be saved as, to the web server and the string path file is the one that has been saved in the database. Here is the generic code that I used...
<!-- schema file -- >
<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:Locale="en-AU">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Images">
<xs:complexType>
<xs:sequence>
<xs:element name="path" type="xs:string" minOccurs="0" />
<xs:element name="image" type="xs:base64Binary" minOccurs="0" />
<xs:element name="fnCount" type="xs:decimal" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
//code behind
this.DsImages = new DataSet();
DataTable ImageTable = new DataTable("Images");
ImageTable.Columns.Add(new DataColumn("path",typeof(string)));
ImageTable.Columns.Add(new DataColumn("image",typeof(System.Byte[])));
this.DsImages.Tables.Add(ImageTable);
FileStream FilStr = new FileStream("myLogofile.jpg", FileMode.Open);
BinaryReader BinRed = new BinaryReader(FilStr);
this.DsImages.Tables["Images"].Rows.Clear();
DataRow dr = this.DsImages.Tables["images"].NewRow();
dr["path"] = "myLogofile.jpg";
dr["image"] = BinRed.ReadBytes((int)BinRed.BaseStream.Length);
this.DsImages.Tables["Images"].Rows.Add(dr);
FilStr.Close();
BinRed.Close();
DynamicImageExample DyImg = new DynamicImageExample();
DyImg.SetDataSource(this.DsImages);
this.crystalReportViewer1.ReportSource = DyImg;
With some tweaks, I was been able to show the image in the report by getting the file path from the database. I thought. But when I tried to show another image file, the image was not shown. Only the re X mark can be viewed. I noticed that when the image is gif, crystal reports cannot show the image. Then I tried to add an gif image manually to the report and nothing happens.
It seems that Crystal reports does not support viewing of gif files? If not, why Is that so?