In this article I will explain how to show images in crystal reports from database in asp.net.
In Previous posts I explained many articles relating to crystal reports. Now in this post I will explain how to dynamically display images in crystal reports from database in asp.net.
Column Name | Data Type | Allow Nulls |
ImageId | Int(set identity property=true) | No |
ImageName | Varchar(50) | Yes |
Image | image | Yes |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Crystal Report Sample</title> </head> <body> <form id="form1" runat="server"> <div> <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True" ReportSourceID="CrystalReportSource1" /> <CR:CrystalReportSource ID="CrystalReportSource1" runat="server"> <Report FileName="CrystalReport.rpt"> </Report> </CR:CrystalReportSource> </div> </form> </body> </html> |
![]() |
![]() |
<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Crystal Report Sample</title> </head> <body> <form id="form1" runat="server"> <div> <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True" ReportSourceID="CrystalReportSource1" /> <CR:CrystalReportSource ID="CrystalReportSource1" runat="server"> <Report FileName="CrystalReport.rpt"> </Report> </CR:CrystalReportSource> </div> </form> </body> </html> |
using System; using CrystalDecisions.CrystalReports.Engine; |
protected void Page_Load(object sender, EventArgs e) { ReportDocument reportdocument = new ReportDocument(); reportdocument.Load(Server.MapPath("CrystalReport.rpt")); reportdocument.SetDatabaseLogon("username","password","SureshDasari","MySampleDB"); CrystalReportViewer1.ReportSource = reportdocument; } |
Imports CrystalDecisions.CrystalReports.Engine Partial Class Default2 Inherits System.Web.UI.Page Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Dim reportdocument As New ReportDocument() reportdocument.Load(Server.MapPath("CrystalReport.rpt")) reportdocument.SetDatabaseLogon("", "", "SureshDasari", "MySampleDB") CrystalReportViewer1.ReportSource = reportdocument End Sub End Class |
![]() |
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|














Subscribe by RSS
Subscribe by Email
16 comments :
Hi suresh..excellent tutorial..how can i show this blob image field page back side for each customer?(contains more than one image for each customer)
thank you so much for clear explanation...its really amazing ur service
nice one....
hi suresh this is nice tutorial.
can we display barcode in report?
thanks
can You show Use of line Graph...
with for each Record and two tables
i hav to show dynamic image from DB..Can u help me??
thanks suresh your code help me a lot...
Excellent Article.Thanks a lot for detail explanation.
Can I Change The Query for Select Some Images.
Means..Can I add "Where" Clause in Sql Query through Coding.
what to do if image in BLOB format
Thanx sir...................):
for giving this information for me
Hi how to print images in varies width and height in same page.
i think this is worth case to store image in database..
always store image in specific folder with unique name
My database have image name and images are in folder.so how can i display image on crystal report.Please help me.
hi suresh, this is sufficient docs to understand crystal report. whenever we are provide asp net training.
I cannot thank you enough for the post.Really looking forward to read more.