Crystal Reports load depending on its mood - c#

I have a crystal report viewer on Windows forms.
The report viewer has one report associated with it. I pass 24 parameters programatically. When i try to run the program, sometimes the reports shows and sometimes the software hangs up.
I m passing same data every time to the report. There are no compile time errors. When I do step-debbuging, then every time the report loads perfectly and there are no hang-ups.
What can be reason of this moody opening of report ????
Edit1:
During step debugging, I found that assignment of reportsource to CrystalReportViewer causes the software to hangup.
goldBillReport = new GoldBill();
crystalReportViewer1.ReportSource = goldBillReport; //Hangs after this !!
SetGoldParameters();
Edit 2:
I have changed the scenario now, I take simple windows form, add a crystal report viewer to it. Secondly I create a blank crystal report.
Now I write the following lines in form load event of the windows form which contains viewer.
goldBillReport = new BillReport();
crystalReportViewer1.ReportSource = goldBillReport ;
80% of times when I load the form it shows the blank report (as required). The remaining time it shows nothing and application just hangs. Why ?
Note: My real application is very large. Is it the problem that the program is not getting proper memory space to open the report. If yes then are there any ways to collect garbage ?
Thank you in advance

I would check that you are correctly disposing of your viewer when the form is closed.
Also, I had an issue where the first time I ran a report it was extremely slow. The solution to this was to load a temp report during Application startup (behind a splash screen). This ensured that the Crystal Report DLL's were fully loaded before the user can generate a report. After I did this the reports loaded in few seconds each time.

Related

Delay in loading multiple reports using report viewer in asp.net

I am facing dramatic delay when loading SSRS reports in reportviewer dynamically in multiple popups. Once the first report is completely loaded, then only then next report starts processing even if I open the reports in parallel.
So I have to wait for long time to load small report if long running report is opened before it. Its not loading in parallel.
I have done some research on this and got to know from the below link that ReportViewer blocks the session for loading each report.
http://www.networksteve.com/enterprise/topic.php/Multiple_report_viewers_on_one_page_issue/?TopicId=56213&Posts=5
Can anyone help me on this. Is there any solution available for this?
I am using Microsoft.ReportViewer.WebForms Version=11.0.0.0, and Framework 4.5 with VS 2012. ReportViewer is in server mode. Please see the code below
reportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
reportViewer.ServerReport.ReportServerUrl = new Uri(ReportServer);
reportViewer.ServerReport.ReportPath = ReportPath.Trim();
reportViewer.SizeToReportContent = true;
reportViewer.ServerReport.Refresh();
Maybe breaking up the processing into multiple threads could be the answer. Create a list of the reports you'll have to get, then use the Parallel class like so...
Parallel.ForEach(reports => report
{
// code for rendering your report
});
Likewise, you can also create an Action delegate for each report and simplify this down to...
Parallel.ForEach(reports => report.Invoke());

ASP.NET Crystal Report Print Automatically

I would like to know if exists the way to send a crystal report directly to the printer without print dialog. Ex. I have an asp.net page with a crystal report viewer and I want send to print once the report have been loaded into the viewer.
I saw an application what it is doing that but I don't know how that work.
I am using
Visual Studios 2010
Crystal Report for .NET Framework (Version=13.0.2000.0)
C# 4
if have a code sample (will be great!!!!)
I have read lot of resources in internet but nothing give me idea how to do what I need.
Thanks in Advance.
J.S.
It does not working like you think. Method PrintToPrinter generates printout directly to printer. Report preview also do the same. If you are executing both methods then report is generating twice. If you have more pritnout pages then report preview generates only visible pages. In most cases this does not change anything, but if report is generating a lot of time, then you are getting a lot of resources from system and you can expect deadlock on database. You also have to remember that if your report is generating new data per each executing then you will have doubled data.
Good I did it
I Just set this values to the ReportDocument.
CrystalReportDocument.PrintOptions.PrinterName = "Printer Name";
CrystalReportDocument.PrintToPrinter(1, true, 1, 1);
anyways I am open to other ideas and suggestion.

Better option to print invoice without using crystal reports

I am using crystal reports in my application that is window based in C# for printing sale invoices and bills but the problem is that it takes some long time to proceed , I need some real time and fast method for this purpose please suggest some solution.
I link my crystal report by a procedure from database, is any alternative for printing invoice rather than crystal reports...
Crystal is "fast" if you take the time to learn what makes her happy. In my experience, the actual printing can account for most of the processing time. It may only take 25ms to create the .rpt file, but then 5000ms negotiating with a printer server. I have spent weeks wrestling with Crystal server-side printing.
It makes a BIG difference:
How you are printing : ReportDoc.PrintToPrinter vs. PrintOutputController.PrintReport
Whether the selected printer uses the same driver as the printer you used to develop the report.
Whether the printer is installed on the server (or just on a remote printer server) and whether it's installed in the profile of the IIS_Identity.
If you are configured incorrectly it can take 1 - 2 minutes to print a report (based on first hand experience). Make a few tweaks and you are suddenly < 50ms.
For instance, if you are using PrintToPrinter() and the specified printer is not in the list of .NET installed printers for the IIS user, it will take a long time to print. Install the printer so it's available to the IIS user, and bam, printing is instantaneous.
I faced an issue in one winforms project where the report was taking a long time to load but it was only for the first time. Later when reports were run, they had no issues at all.
We assumed that time was taken by framework to load crystal assemblies in memory.
So I created a hack that whenever application is run, I loaded an empty report in a background thread.

Microsoft report viewer shows no report

I am working on a small windows application. The application needs to show some reports. For each report, I made a simple form with Report Viewer control. When the form shows up, I call the RefreshReport() method and the report is shown. My problem is this - one report does not show up at all. I get only form with empty ReportViewer control. There is also no "Generating report" message. The query I use returns the correct data, but I am unable to get anything when I run the application. For each of the reports, I am using separate dataset. In each DtaSet I have placed the tables I want to use in corresponding report. I
I have also tried to create this particular report using Report Server Project Wizard (Business Intelligence Project > Report Server in Visual Studio). It showed the report correctly. I used exactly the same settings, same query, everything is identical. What could be the problem? Why is Visual Studio unable to show me this report? The other reports are working fine.
Thanks
Ok, I found out what was happening. For some reason, an exception was thrown during the creation of the report. The exception was "invisible" - there was no any message about it, nothing. I caught it when I was debugging the whole thing line by line. It seems that the exception originates on the database level, when the query is executed (the query contains several JOIN commands). I solved the whole thing by simply putting the Fill() method, which fills the dataset when the form is opened in the try block, with an empty catch block. The report showed correctly.

How To Speed Up Loading DataSets

When Using SQL Server Reporting Services (client Reports), whenever a Client (rdlc) report Opens Visual Studio Loads entire application datasets,
how to speedup loading this all datasets or how to change the process to only load specific Dataset to use in Report ?
Bulk Insert (or the bcp utility) is your Friend for speedy data imports. Your probably going to have to write a data loader in some language though.
database snapshot could be an option
http://www.sql-server-performance.com/articles/dba/sql_server_database_snapshot_p1.aspx
I may be understanding you question wrong, but on Win Forms I've been loading the needed data sets manually. I basically have a method that loads the proper data from my database, attach the needed data sets to my report viewer using Me.ReportViewer1.LocalReport.DataSources.Add, then I just display my report using Me.ReportViewer1.LocalReport.ReportEmbeddedResource. My reports are embedded resources, but you can load it from a file too, I just can't remember off the top of my head. Once everything is loaded, call RefreshReport, and the report displays. Well, those are the main points, I don't have my code to look, but I know those are the basic steps.
Currently I have been researching how to load data sets on the fly as the user navigates through the report. My work around for this at the moment is to capture the ReportError event, check what report is trying to be displayed from the sender (this is the report viewer object), and load the dataset using the above. The only issue that I am having is that I don't have a loading screen when I am loading the dataset at this point, so it looks like my application freezes. I haven't figured out how to get back to that circular loading screen, but for now, I have a loading window that is displayed while I load. remember, when you get the error, the report trying to be displayed is already set as the local repot, so all you have to do is have a case/if statment checking for the report and loading the data as needed.
Can't you set a default parameter to something which stops much being returned, and only change it to a real one at run-time?

Categories

Resources