on 09-20-2022 11:40 AM
I am new to Crystal Reports in ASP.net MVC. I have a main report with a logo from a subreport. The subreport is a separate .rpt file that gets its data from an image saved in the database in a binary string format. This logo's datatype when checked in the xsd is String.Byte[].
However, when I run the report viewer in the web browser, no image is being displayed. Even when I click on the box of the logo in the web browser and the separate rpt file is loaded, the report is blank.
I can confirm that this specific logo saved in the DB can be displayed in the report viewer when I tried to add a column for the image in the stored procedure that is used to populate and dragged that field in my main report.
I hope someone can help me as I am stuck here for days. This is what my code looks like in the report viewer:
report.Subreports["Logo"].ReportDefinition.ReportObjects[0].Height = 1500; //Convert.ToInt32(reportParam.CRParameters["COMPANYLOGOHEIGHT"]);
report.Subreports["Logo"].ReportDefinition.ReportObjects[0].Width = 5250; //Convert.ToInt32(reportParam.CRParameters["COMPANYLOGOWIDTH"]);
report.Subreports["Logo"].ReportDefinition.ReportObjects[0].Left = 13;
report.SetDataSource(reportParam.DataSource["Table"]);
report.Subreports["Logo"].SetDataSource(reportParam.DataSource["Logo"]);
StatementOfHoldingsReport.ReportSource = report;
I believe I am missing something when the image is being displayed in the separate sub report. I can also confirm that the string of bytes can be found in the row of the reportParam.DataSource["Logo"]
.
"PS: It doesn't also show when I try to view the report in CR Designer."
This suggests you do have network or permission issues if it only works some times. Could be resource issues also.
Not sure what else to suggest, if it's off/on in CRD it's going to be an issue in the SDK because the SDK uses the same API's CR Designer uses.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does it work when you view the report in CR Designer?
If it doesn't work in CRD it won't work in code.
Try saving the image in a location that IIS has permission to access.
Maybe WireShark will help debug the problem:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Don,
The image is not on my machine and is only saved as binary data. I tried creating a Dataset and filling it up using a stored procedure in the Database Expert (meaning I need to log in to the DB to populate). The image appeared in this way.
However, when I tried to fill the Dataset programmatically in code using a stored procedure, the image is not showing.
PS: It doesn't also show when I try to view the report in CR Designer.
Version is fine, CR loads the Assembly Framework version, not the dll version.
It could be a API order issue, what happens if you comment out all of the Image and DB code and just preview the report, let it prompt for DB connection info?
If your data source gets is data from an Stored Procedure why not connect to the SP rather than an XML file?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes update the Report in either VS or use CR 2016 or Cr 2020 to update it.
Open the report and Verify database should fix it but you may need to use Set Database Location...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I did this but the image still doesn't load. All CrystalDecisions references in my Web.config uses CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304. Should this also be changed? If yes, what should be the correct version? And if there are other things I should change, please let me know.
Thank you Don, for helping me so far.
Hello,
Ah, thank you for checking. You are using SP 31, it had a lot of image and viewer related issues.
Can you download and upgrade your app to use SP 32, it fixed a lot of them:
https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads
Thank you
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Don,
I installed the SP 32, however, I am getting Failed to load database information error. According to this page, the cause is old Crystal Report has not been updated for use in the current version of Crystal. With this, should I do something on the existing CR?
This is the stack trace and I didn't modify anything on the code. Exception was happening on report.SetDataSource
[COMException (0x800002cd): Error in File temp_f9119fe1-68fa-4004-bc38-133ff2da92f1 1168_18204_{90723655-5B93-4CA9-975E-82C8ED598390}.rpt:
Failed to load database information.]
CrystalDecisions.ReportAppServer.Controllers.DatabaseControllerClass.ReplaceConnection(Object oldConnection, Object newConnection, Object parameterFields, Object crDBOptionUseDefault) +0
CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type) +536
CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type) +136
[DataSourceException: Error in File temp_f9119fe1-68fa-4004-bc38-133ff2da92f1 1168_18204_{90723655-5B93-4CA9-975E-82C8ED598390}.rpt:
Failed to load database information.]
CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) +337
CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type) +203
CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet) +60
CallSite.Target(Closure , CallSite , InvestorStatementOfHoldingsReport , Object ) +135
Need versions you are using
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.