on 07-30-2014 5:14 PM
Hi all.
I am having a lot of problems with all my reports that contains any subreport/s (only crashes in client´s machines, not development machine), Due this reports are a bit complex, ill try to make a new simple report with a subreport to see if it works but i had no results, and the problems is that i dont receive any message error, the program just crashes. I looked up for a solution and any of it works for me, The most common problem with subreports is that the sql query of the subreport and dataset are different, in my case are the same and the report its too simple to crash the application.
Here is the dataset that is assigned to the subreport:
Dim _dsld As DataSet = iCalc.SelectSql("select CR.pr_id,cr_id from corridas as cr inner join prestamos as pr on pr.pr_id=cr.pr_id where pr_nombre='" + CBOPrestamo.SelectedValue + "'")
Dim rep_ As New CRPrueba
rep_.Subreports("CRPruebaSub.rpt").SetDataSource(_dsld.Tables(0))
rep_.SetParameterValue("pr_nombre", CBOPrestamo.SelectedValue)
CrystalReportViewer1.ReportSource = rep_
Here is the subreport command:
select CR.pr_id,cr_id from corridas as cr inner join prestamos as pr on pr.pr_id=cr.pr_id where pr_nombre='{?pr_nombre}'
If i dont assign a dataset (datatable) to the subreport and insted of it i put the name of the loan, the subreport doesnt crashes, then the problem is at the moment of the dataset assignment to the subreport but i dont understand why crashes, in fact, i dont understand why reports that i dont made a change are crashing the application when it does not happened before.
I hope you can help me because if i can´t solve it,I'll have to make the reports without subreports (increasing the complexity of the reports)
Thanks in advance
A bit of info missing:
Version of CR - please be precise
Version of VS .NET
Define "crash". Error? Behavior? Symptom?
I am also assuming that you are loading the main report - and you are not showing that code? E.g. the full code would be something like:
Dim crReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
crReportDocument.Load("C:\WindowsApplication5\test.rpt")
//loop through all the sections to find all the report objects
foreach (CrystalDecisions.CrystalReports.Engine.Section crSection in crSections)
{
crReportObjects = crSection.ReportObjects;
//loop through all the report objects to find all the subreports
foreach (CrystalDecisions.CrystalReports.Engine.ReportObject crReportObject in crReportObjects)
{
if (crReportObject.Kind == ReportObjectKind.SubreportObject)
{
//you will need to typecast the reportobject to a subreport
//object once you find it
crSubreportObject = (CrystalDecisions.CrystalReports.Engine.SubreportObject)crReportObject;
string mysubname = crSubreportObject.SubreportName.ToString();
//open the subreport object
crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName);
//set the database and tables objects to work with the subreport
rep_.Subreports("CRPruebaSub.rpt").SetDataSource(_dsld.Tables(0));
}
}
}
}
CrystalReportViewer1.ReportSource = crReportDocument
Couple of things to try:
1) Don't set the parameter - what happens now?
2) Save out the subreport and run it as it's own main report. What happens now?
Also see the sample apps csharp_win_subreport_basic.zip and csharp_win_subreport_logon.zip
here:
Crystal Reports for .NET SDK Samples - Business Intelligence (BusinessObjects) - SCN Wiki
Developer Help Files:
SAP
Crystal Reports .NET SDK Developer Guide
SAP
Crystal Reports .NET API Guide
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Version of CR: 13.0.4.705
Version of VS .NET: VS 1010 Ultimate
Define "crash". Error? Behavior? Symptom?: After press the button that show the report the application does not respond, just appear a message box with a button and a label that says "the program has stoped and need to close", then I press the button and the aplication close, that´s all i can do.
The problem here is that in some times the reports runs just fine, but some times not, this can happen every time i compile the proyect and rune the new .exe file.
I will try your suggestions, for now i have another problems with the application and need to solve it first.
Thanks in advance and we keep in touch.
Was able to solve the problem and the solution was to modify the .exe.config file with this information:
<?xml version="1.0"?>
<configuration>
<configSections>
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
After save the file and replace it in clients machine all the report works fine.
Thank you very much and I hope my solution will be of help for another people.
Yup. Documented in this KBA, but I did not have enough info to suggest the solution...
- Ludek
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.