ReportDocument take a log time to load

If the production database is different from the development database loading the report take more then two minutes.
Is the a way to avoid this issue.
The code to print the report is the following....
Cursor.Current = Cursors.WaitCursor;
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = m_ServerName;
connectionInfo.DatabaseName = m_DatabaseName;
connectionInfo.UserID = m_UserID;
connectionInfo.Password = m_Password;
connectionInfo.IntegratedSecurity = false;
   
ReportDocument myReport = new ReportDocument();

myReport.FileName = reportPath;
myReport.SetDatabaseLogon(m_UserID, m_Password);
            
myReport.Load(reportPath); // takes about two minutes

SetDBConnectionForReport(connectionInfo, myReport);
SetDBConnectionForSubreports(connectionInfo, myReport);

CRPrint.ReportSource = myReport;
CRPrint.SelectionFormula = selFormula;
CRPrint.RefreshReport();
if (printerName == string.Empty)
{
    Cursor.Current = Cursors.Default;
    PrintDialog dlg = new PrintDialog();
    dlg.ShowDialog();
    Cursor.Current = Cursors.WaitCursor;
    myReport.PrintOptions.PrinterName=
        dlg.PrinterSettings.PrinterName;
    printerName = myReport.PrintOptions.PrinterName;
}
myReport.PrintToPrinter(1,false,1,1);
Cursor.Current = Cursors.Default;

Open in new window

vss-ptAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
I would check to see if the same printer is available on both systems.  I find when I get foreign reports they take a long time to load and then I get an PRINTER message saying the printer the report was developed with is not available and the default printer will be used.  In general I never have the database available.

These are reports users upload here so I don't expect to have the database.

mlmcc
0
PCIIainCommented:
Crystal 2008 just seems to take a very long time to switch the data to different databases. We have speeded up some necessary reports by converting the data source to a command, meaning it only has one 'table' to switch databases, but there was a significant drop in loading speed between Crystal XI and Crystal 2008.
0
vastoCommented:
You can save the production report with the production connection and you will avoid crystal reports to verify the database each time you switch the connections. You will still need to set database connection , but this will be just to set the user and password. However loading is before SetDBConnectionForReport so your problem is somewhere else. 2 minutes is too big period . It looks like timeout to me.  It can be a missing printer, mapped drive or a connection issue.
Are you running the report on the same machine where test world report is working fine?
0
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference ithrough the Colors of STEM program.

vss-ptAuthor Commented:
By changing the database to the production on Crystal Reports solves the problem, but still if the client changes teh database name or server location the problem persists

The mais issue is that the same report is used in diferente Servers / databases. It's anoying tho produce one for each server /database.

It seem that on Load it check´s the database connection, before I have the chance to change it.

I have seen some 'load' event preapps is there the correct place to change logon parametes?
0
mlmccCommented:
Is there an OPEN method on the report document?
I believe LOAD tries to run the report where as OPEN just opens the report for modifications like you want to do?

myReport.OPEN(reportPath);

Why do you do a REFRESH?
If you are always going to do a refresh, you could simply not save the report with data and the report will automatically load the newest data.

mlmcc
0
vastoCommented:
Do you have option "Save data with report" checked (in Report options) ?
0
vss-ptAuthor Commented:
No I don't wave the option 'save data with report' and there is no 'open' method available.
I have addes thsin tow lines with no efect.

            myReport.FileName = reportPath;
            myReport.SetDatabaseLogon(m_UserID, m_Password, m_Database);
            myReport.Load(reportPath);
 There is a EnterpriseSession method, what is it for?
0
vss-ptAuthor Commented:
That is what I'm doing.
The main isue is the load method.
It take abou 2 minut's to realize the database is not available.
0
mlmccCommented:
I don't see the LOAD used in the sample

mlmcc
0
vastoCommented:
vss-pt, obviously the report is trying to connect to the database on load. Any chance to upload the report here ?
If you cannot upload then:
 - What is the version of this report ? I have seen some crystal 8 -8.5 reports with integrated security which were trying to connect to the initial database no matter what you are doing. What is your login type ?
 - Do you use command ?
 - Do you have dynamic value list ?
0
vss-ptAuthor Commented:
mlmcc:
The load method is the line in samples...
cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt")
...
vasto:
I don't have the final release on hand, but this repçort prodices the same efect.


APL-Frente.rpt
0
vss-ptAuthor Commented:
vasto:
Do you need more info?
0
vastoCommented:
vss-pt, I will check the report. Thanks!
0
vss-ptAuthor Commented:
I think the problem is not report related, but with the Crystal API for VS 2005.
But still if you have any ideas. For now I have created a copy of the report for each database,
I know it doesn´t make any sense but I cant have the use waitin 2 minutes to print a card.
0
vastoCommented:
vss-pt , something is messed up with the database information.
We have a tool which is changing the datasource to fix issues like this. Please check the report and let me know if it is fixed now. APL-Frente.rpt
0
vss-ptAuthor Commented:
vasto:
Yes in fact loadreport executes imediatly, but setting server/database/user/password wont prevent login box to be displayed.
On the login box, the database is blank so we cannot even manualy logon.
But still this is the way to solve the problem

Two questions, the first one is what product do you use to 'fix' the report? Also what version is the report on?




0
vastoCommented:
I used a tool developed for our clients. It is similar to this one:
http://r-tag.com/ReportDataSource.aspx
It will not work for your case because it is designed to change connection for all reports in a folder and may useful for migration but not for dynamic connection change. However it can be used to reset current connection data so you will be able to set it in your code.

The report was saved by the tool to ver 13 but it is compatible to whatever is the original version (except before ver. 9). Of course  it could be saved to other versions if the right components are used. As I said this tool is used by existing customers and our software is based on ver 13.

What I can do is to reset the report connection data to something that may work for you and then you will be able to set it in your code.  As it is in the sample, connection is set to a database that exists on my computer and obviously you cannot use it.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vss-ptAuthor Commented:
Partial solution, But a very good lead.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.