I'm using CRXI, VB2005, and an MSAccess database.
I have an issue with large images being visible in the report when run through crystal -- but when integrated into VB with the crviewer - they do not appear (no red x's -- just the border outline appears). What I'm wondering is if I can add the image at runtime through VB - I want to test this to see if this override will work and make the image visible.
Here is my code to view a crystal report (it is ugly as I had to cycle through the report and apply the logon info to every table in the report as well as every table in each subreport):
now, I found some code here where someone was putting an image into a table and then putting a report.datasource to the table. How can I integrate a table like this (code below) with what I have done above?
Thanks.
I have an issue with large images being visible in the report when run through crystal -- but when integrated into VB with the crviewer - they do not appear (no red x's -- just the border outline appears). What I'm wondering is if I can add the image at runtime through VB - I want to test this to see if this override will work and make the image visible.
Here is my code to view a crystal report (it is ugly as I had to cycle through the report and apply the logon info to every table in the report as well as every table in each subreport):
Code:
Public dbPath As String = "C:\CentralData.mdb"
Public rptPath As String = "C:\"
Public rptEastSpcl As String = rptPath + "specialPricing_East_1183v2.rpt"
'button uses this to show the report
Call showReport(rptEastSpcl)
Private Sub showReport(ByVal rptName As String)
Dim crReport As New ReportDocument
Dim crTable As Table
crReport.Load(rptName)
'Step 1 cycle through main tables on report and set to hit db
For Each crTable In crReport.Database.Tables
crTable.Location = dbPath
Next crTable
Dim ci As New ConnectionInfo()
Dim subObj As SubreportObject
Dim obj As ReportObject
ci.DatabaseName = dbPath
For Each obj In crReport.ReportDefinition.ReportObjects
If (obj.Kind = ReportObjectKind.SubreportObject) Then
subObj = CType(obj, SubreportObject)
If Not (ApplyLogon(crReport.OpenSubreport(subObj.SubreportName), ci)) Then
'These are the ones that hit the database
For Each crTable In crReport.OpenSubreport(subObj.SubreportName).Database.Tables
crTable.Location = dbPath
Next crTable
End If
End If
Next
frmVwrCustom.crViewer1.ReportSource = crReport
frmVwrCustom.Show()
End Sub
now, I found some code here where someone was putting an image into a table and then putting a report.datasource to the table. How can I integrate a table like this (code below) with what I have done above?
Code:
Dim data As New DataSet()
Dim row As DataRow
data.Tables.Add("Images")
data.Tables(0).Columns.Add("img", System.Type.GetType("System.Byte[]"))
Dim fs As New FileStream("C:\test.jpg", FileMode.Open)
Dim br As New BinaryReader(fs)
row = data.Tables(0).NewRow()
row(0) = br.ReadBytes(br.BaseStream.Length)
data.Tables(0).Rows.Add(row)
br.close
fs.close
br = Nothing
fs = Nothing
' CrystalReport1 is a strongly typed report created in Visual Studio.
Dim cr As New CrystalReport1()
cr.SetDataSource(data)
CrystalReportViewer1.ReportSource = cr
Thanks.