• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 553
  • Last Modified:

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
0
metropia
Asked:
metropia
  • 7
  • 3
  • 3
2 Solutions
 
LinInDenverCommented:
Does the RPT file have data saved with it? This can cause problems.

Open the RPT and under FILE, make sure "Save Data with Report" is unchecked.

Resave report.

Try again!
0
 
metropiaAuthor Commented:
"Save Data with Report" was unchecked.

Thank you!
0
 
LinInDenverCommented:
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
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
metropiaAuthor Commented:
No problem. The option was unchecked. I still have my problem.
0
 
LinInDenverCommented:
Oh Darn!

Well hopefully another EE will ping in.
0
 
metropiaAuthor Commented:
thank you anyways!
0
 
metropiaAuthor Commented:
I hope that happens too :)
0
 
mlmccCommented:
Have you tried usiing that code in VS2010 with CR4VS2010?

You can download CR4VS2010 here
http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/22083

mlmcc
0
 
metropiaAuthor Commented:
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
0
 
mlmccCommented:
Does the web-user have database permissions?

mlmcc
0
 
metropiaAuthor Commented:
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

0
 
mlmccCommented:
You should be able to replace the viewer line with the export line

CrystalReportViewer1.ReportSource = crystalReport;

mlmcc
0
 
metropiaAuthor Commented:
Thank you all for your help!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now