Link to home
Start Free TrialLog in
Avatar of metropia
metropiaFlag for United States of America

asked on

Report Exporter for Crystal Report.

I have a Crystal Report that when is displayed as PDF on IE, does not retrieve any of the database data. Two parameters are passed via the query-string.

The report pulls data when opened directly on crystal.

I am not sure what exactly is happening, but what I know is that we are querying some SQL Server 2008 databases and I don’t think that the report exporter that I am using written using Visual Studio 2005 can handle that kind of database connection.  

I would like to ask if there is anyone that have a report exporter written on Visual Studio 2010 that I can use?

I am uploading a copy of mine, hopefully a newer version is not too different and easy to implement to what I have.

     PrintGTCInspectionReport.aspx.cs.txt
SOLUTION
Avatar of LinInDenver
LinInDenver
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of metropia

ASKER

"Save Data with Report" was unchecked.

Thank you!
Sorry, do you mean it was checked and now unchecked?

What I mean to say, did this solve the problem or do you still need help?

Lin
No problem. The option was unchecked. I still have my problem.
Oh Darn!

Well hopefully another EE will ping in.
thank you anyways!
I hope that happens too :)
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I can see it inside the CR viewer when I run it in VS2010.
I get the CR prompt to enter the user log on credentials, then to supply the required parameters.

That is without using the export to PDF code on my page.

When I add the export to PDF code, then I get the PDF version of the report, supply the parameters on the query-string, but the report is empty then.

I am including a copy of my report.
GTCInspectionReport.rpt
Avatar of Mike McCracken
Mike McCracken

Does the web-user have database permissions?

mlmcc
I am passing the log on credentials on Page_Load

now I don't get the prompt.

The same for the 2 required parameters.

I enter the url, providing the 2 query-string values, the report opens on the CR viewer.

How can I within Page_Load, do the export to PDF so it does not open on the CR viewer?

Thank you.
protected void Page_Load(object sender, EventArgs e)
    {
        ReportDocument crystalReport = new ReportDocument();

        string baseId = "";
        string lotId = "";

        baseId = Request.QueryString["baseID"].ToString();
        lotId = Request.QueryString["lotID"].ToString();
        
        crystalReport.Load(Server.MapPath("GTCInspectionReport.rpt"));
        crystalReport.SetDatabaseLogon("xxxxxx", "xxxxxx");
        crystalReport.SetParameterValue("baseID", baseId);
        crystalReport.SetParameterValue("lotID", lotId);
        CrystalReportViewer1.ReportSource = crystalReport;
    }

Open in new window

You should be able to replace the viewer line with the export line

CrystalReportViewer1.ReportSource = crystalReport;

mlmcc
Thank you all for your help!