Hello,
I am using the codes below to view images from an ACCESS database listed as ".\image.png", the images are included in the application's path. I'm able to view the images while running crystal reports alone; However when I include the same report and databse in my VB.NET application, the images don't show. I was told that the report looks for the images in a temp folder, an alternative solution would be to copy the image files to a temp folder before attempting to run the report, but so many things can go wrong with such approach. Do you have a better solution to this problem?
Thanks in advance.
Victor
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myaop6viewer As New aop6viewer
Dim myaop6report As New AOP6V2
Dim crConnectionInfo As ConnectionInfo = New ConnectionInfo
crConnectionInfo.ServerName = (Application.StartupPath & "\AOP6V2.mdb")
crConnectionInfo.Password = "testaop"
setDBLogonForReport(crConnectionInfo, myaop6report)
myaop6report.RecordSelectionFormula = "isnull({image.country}) = false"
With myaop6viewer
.CrystalViewer22.ReportSource = myaop6report
.Show()
End With
myaop6report = Nothing
End Sub
Private Sub setDBLogonForReport(ByVal connection As ConnectionInfo, ByVal report As ReportDocument)
Dim mytables As Tables = report.Database.Tables
Dim mytable As CrystalDecisions.CrystalReports.Engine.Table
For Each mytable In mytables
Dim mytablelogoninfo As TableLogOnInfo = mytable.LogOnInfo
mytablelogoninfo.ConnectionInfo = connection
mytable.ApplyLogOnInfo(mytablelogoninfo)
Next
End Sub