PDA

Click to See Complete Forum and Search --> : Load Picture in Crystal Report with MDB


anu80
Dec 17th, 2006, 09:16 PM
Hi there,
I have stored the picture's path in MDB(MS Access) file. I am able to load the text files to the report, but not the picture, how do I get both the text and picture to be loaded to the Crystal Report. Please help. Thanks.

This the code I have written so far : -

Dim cn As OleDbConnection
Dim cmd As OleDbCommand

cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DB.mdb;")
cn.Open()

cmd = New OleDbCommand("SELECT * FROM tbl_KB_Main INNER JOIN tbl_KB_Issue ON tbl_KB_Main.KBM_GIDNo = tbl_KB_Issue.KBM_GIDNo WHERE tbl_KB_Main.KBM_GIDNo = 'GID12120' ORDER BY tbl_KB_Issue.KBM_DNo ", cn)

Dim DA As New OleDbDataAdapter(cmd)
Dim DS As New DataSet
Dim strReportName As String
DA.Fill(DS)
strReportName = "rpt_View_EPKMI"

Dim strReportPath As String = "C:\" & strReportName & ".rpt"

Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument

rptDocument.Load(strReportPath)
rptDocument.SetDataSource(DS.Tables(0))
rptViewer.ShowRefreshButton = False
rptViewer.ShowCloseButton = False
rptViewer.ShowGroupTreeButton = False
rptViewer.ShowZoomButton = True
rptViewer.ReportSource = rptDocument