Click here to Skip to main content
16,004,761 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to display/show image in crystal report-13 using ASP.net and vb language .Using drag-drop of image field into crystal report,the image showing blank.
Posted
Comments
Sandeep Mewara 16-Feb-13 2:53am    
Tried anything so far? Why do you think it will be different for Crystal 10 or 11 or 12?

Crystal report designer will not show image just on drag-drop. It will show when report is generated.

Following should help even though not on v13:
Display Image in Crystal Report using ASP.NET[^]

There are lots of articles on web for the same. If needed, look at others and try out.
 
Share this answer
 
Create a BLOB field in database with a column Name COLUMNNAME.
Use the following code for getting the reference of the image
Private Function authSign(ByVal doccode As String) As DataTable
       'here i have define a simple datatable inwhich image will recide
       Dim dt As New DataTable()
       'object of data row
       Dim drow As DataRow
       ' add the column in table to store the image of Byte array type
       dt.Columns.Add("COLUMNNAME", System.Type.GetType("System.Byte[]"))
       drow = dt.NewRow
       ' define the filestream object to read the image
       Dim fs As FileStream
       ' define te binary reader to read the bytes of image
       Dim br As BinaryReader
       ' check the existance of image
       If (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\Lab Reports\Signatures\" + doccode + ".JPG")) Then
           ' open image in file stream
           fs = New FileStream(AppDomain.CurrentDomain.BaseDirectory + "\Lab Reports\Signatures\" + doccode + ".JPG", FileMode.Open)
       Else
           ' if phot does not exist show the nophoto.jpg file
           fs = New FileStream(AppDomain.CurrentDomain.BaseDirectory + "\Lab Reports\Signatures\noSign.jpg", FileMode.Open)
       End If
       ' initialise the binary reader from file streamobject
       br = New BinaryReader(fs)
       ' define the byte array of filelength
       Dim imgbyte(fs.Length + 1) As Byte
       ' read the bytes from the binary reader
       imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)))
       drow("COLUMNNAME") = imgbyte
       ' add the image in bytearray
       dt.Rows.Add(drow)
       ' add row into the datatable
       br.Close()
       ' close the binary reader
       fs.Close()
       ' close the file stream
       Return dt
   End Function


Returned Datatable can be passed as a sourse to ur report or ur subreport.Here i used subreport
of report name AuthSignature.rpt in my main report
Dim report1 As New ReportDocument
       Dim auth As New DataTable
       auth.Columns.Add("COLUMNNAME", System.Type.GetType("System.Byte[]"))
       auth = authSign(OrderDtlType.t_ILS_ORDTAUTHDOCTORCODE)
       report1.Subreports("AuthSignature.rpt").SetDataSource(auth)
       CrystalReportViewer_rad.ReportSource = report1
       CrystalReportViewer_rad.DataBind()
 
Share this answer
 

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