cancel
Showing results for 
Search instead for 
Did you mean: 

CrystalReport in VS2010

Former Member
0 Kudos

Hi Friends,

i am trying to use CrystalReport in VisualStudio 2010. for this task i have imported CrystalDecisions.CrystalReports.Engine dll(version:9.1.3300.0).

please find some question below:-

  • Am i using correct dll version in VisualStudio 2010?

  • I am creating ReportDocument object for loading the rpt file. now i start with build and run the solution but unfortunately solution din't run but at the same time i commented ReportDocument object then at that time solution is run successfully .

        so is there any version issue?

Please suggest on the above issue.

Many Thanks in advance.

Thanks

Rohit

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor
0 Kudos

No you're not using the correct files for VS 2010 - that is a very old version of the SDK you're using.

You can download the correct Crystal Reports for Visual Studio from here:  http://scn.sap.com/docs/DOC-7824

1.  Uninstall the existing SDK - the new one does not play well when installed side-by-side with the old one.

2.  Download and install the latest "Install Executable" from the link above.  This will integrate the SDK into the VS 2010 IDE.

3.  Also available on this link are various "runtime" installs for use when deploying your application - DO NOT install any of them on the workstation where VS is installed!

-Dell

Former Member
0 Kudos

Thanks Dell for your reply.

I have run the SDK as per your suggestion and now i have updated DLL for the solution.

now i have create the object of ReportDocument and when i run the application then its giving error.

please find below error:-

Can you please suggest me on this?

DellSC
Active Contributor
0 Kudos

Have you added the path to the Crystal SDK to the library path for your application?  I haven't ever had this issue, so I'm not sure where to point you to for an answer.  Maybe or will have an answer for you.

-Dell

0 Kudos

So to validate you did use the correct installers do this:

Uninstall everything CR for VS.

Install this on your DEV PC ONLY:

http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0_14.exe

Create a new Winform Project and select 4.0 Framework, do not use Client.

Add the Crystal reports Viewer to the Tool bar and drop the version 13.0.x.x onto your form.

Once you do that then you will see the 3 CR assemblies added to your project, Engine, Shared and Viewer.

Instantiate the Engine and the report document and then one 2 lines to open your report directly and set the report object to the viewer and run the app.

What happens?

If that works then your original project may have some references pointing to the wrong CR files.

When upgrading your app VS should simply replace all of the CR assemblies but sometimes it does not replace the viewer so open your form, delete the CR viewer and add it back in, making sure it's version 13.

Don

former_member183750
Active Contributor
0 Kudos

Keeping in mind that you were previously referencing an older assembly, make sure that you uninstall any previous versions of CR that bundled with any Visual Studio. E.g.; CR 9.1, CR 10.2 and CR 10.5.

As Dell implied, make sure you are referencing all the needed assemblies and they are all version 13.x. At minimum you will require the following references:

CrystalDecision.CrystalReports.Engine

CrystalDecisions.Shared

CrystalDecisions.ReportSource

CrystalDecisions.Windows                  //for win apps

CrystalDecisions.Web                          // for web apps

The detail view in your screenshot has CrystalDecision.ReportAppserver

This indicates that you are trying to use the InProc RAS SDK. Unless you have a real need for this, don't - not for now anyhow. To help you get started, you may want to have a look at the following doc:

Crystal Reports for Visual Studio 2005 Walkthro... | SCN

Don't let the title throw you as the doc applies fully to all versions of CR and VS .NET.

There are also a number of sample apps listed here:

Crystal Reports for .NET SDK Samples - Business Intelligence (BusinessObjects) - SCN Wiki

I recommend starting with vbnet_win_simplepreviewreport.zip and then vbnet_win_dbengine.zip. After that exporting or printing or parameter passing - depending on your project requirements.

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow me on Twitter

Former Member
0 Kudos

Thanks a lot for your reply.

still i am getting error related to Path.

actually i just want to export rpt file to excel files.i am using console application for the same.

  ReportDocument rt = new ReportDocument();

               rt.Load(@"C:\bPaid_3_TRACS_to_BankWORKS.rpt");

                ExportOptions rptExportOption;

                DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();

                PdfRtfWordFormatOptions rptFormatOption = new PdfRtfWordFormatOptions();

                string reportFileName = "C:\abc.pdf";

                CrDiskFileDestinationOptions.DiskFileName = reportFileName;

                rptExportOption = rt.ExportOptions;

                {

                    rptExportOption.ExportDestinationType = ExportDestinationType.DiskFile;

                    //if we want to generate the report as PDF, change the ExportFormatType as "ExportFormatType.PortableDocFormat"

                    //if we want to generate the report as Excel, change the ExportFormatType as "ExportFormatType.Excel"

                    rptExportOption.ExportFormatType = ExportFormatType.PortableDocFormat;

                    rptExportOption.ExportDestinationOptions = CrDiskFileDestinationOptions;

                    rptExportOption.ExportFormatOptions = rptFormatOption;

                   

                }

                rt.Export();

i am using below references:

using CrystalDecisions.CrystalReports.Engine;

using CrystalDecisions.Shared;

using CrystalDecisions.ReportSource;

Please suggest on this and agian thanka a lot for your time.

Thanks,

Rohit

former_member183750
Active Contributor
0 Kudos

I wonder if throwing Process Monitor at this will help. The ProcMon logs may tell us what path is the issue. You'd be looking for message like Access Denied.

ProcMon is here:

Process Monitor

- Ludek

former_member188030
Active Contributor
0 Kudos

Just wondering, do you get the same error for only 3 lines of code.

ReportDocument rt = new ReportDocument();

               rt.Load(@"C:\bPaid_3_TRACS_to_BankWORKS.rpt");

CrystalReportsViewer1.ReportSource= rt;

Do you see the report loaded in rt? (breakpoint)

What happens when you directly assign the report to viewer (set ReportSource property of viewer control).

I did face this issue with SP14 web app but it was intermittent in my case and I resolved it by adding ReportDoc object to HTTP session.

Could you also try a sample web app with above code.

Thanks,

Bhushan

Former Member
0 Kudos

Hi Bhushan,

Thanks for your reply.

I hope , i am not getting error on Load.beacuse through debugger(breakpoint) i can see some data load in rt.

i am creating console Application so i am not using CrystalReportsViewer1. This application intailly will load Rpt file and then export to excel file.

You can view my piece of code above.



Thanks

Rohit

0 Kudos

Can you try the code Bhushan suggested? If that does not work then create a new report with just a text object with "Hello World" in it so it removes all database and other report parts from the report and simplify.

Don

Answers (0)