Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all,

I am using VB.Net with Crystal Report.



I need to change Dynamic Logo Image from my header part, that Image

come from Database (that type is Var binary.) In my application i

stored and retived the image as var binray. Its working but in crystal

report how could is possible Any one knows please give some ideas about

that.


Thanks.
SundaraRajan.C
Posted

 
Share this answer
 
Create a XSD File to design your report.
Like
XML
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="FrontPage" targetNamespace="http://tempuri.org/FrontPage.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/FrontPage.xsd" xmlns:mstns="http://tempuri.org/FrontPage.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Document">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="FrontPage">
<xs:complexType>
<xs:sequence>
<xs:element name="CODE" type="xs:string" />
<xs:element name="ACCCODE" type="xs:string" minOccurs="0"/>
<xs:element name="SCMGRPCODE" type="xs:string" />
<xs:element name="GIVENNAME" type="xs:string" />
<xs:element name="CLIMG" type="xs:base64Binary" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="DocumentKey1">
<xs:selector xpath=".//mstns:FrontPage" />
<xs:field xpath="mstns:ACCCODE" />
</xs:unique>
</xs:element>
</xs:schema>



Design your report using the XSD File
Note the CLIMG field is your Image field

Now fetch your data into a dataset.

Add a new field in yout dataset using
Dim c6 As New DataColumn("CLIMG", Type.GetType("System.Byte[]"))
ds.Tables(0).Columns.Add(c6)



Now Set the image into your dataset using

<pre lang="vb">Dim bArr() As Byte
bArr = ds.Tables(0).Rows(0)("MIMAGE")
ds.Tables(0).Rows(0)("CLIMG") = bArr


Dont forfget the change the dataset name to the name specified in
<xs:element name="FrontPage">
as
ds.Tables(0).TableName = "FrontPage"


Set the datasource

rptReport.SetDataSource(ds)
 
Share this answer
 
Comments
souravghosh18 6-Jul-10 8:15am    
Good Explanation !!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900