EzDevInfo.com

crystal-reports interview questions

Top crystal-reports frequently asked interview questions

SAP Crystal Reports runtime for .Net 4.0 (64-bit) [closed]

I need a runtime for SAP Crystal Reports for .Net 4.0 (64-bit). I have been searching from the web but not getting any success. Can I get the URL from where can i download this


Source: (StackOverflow)

Could not load file or assembly CrystalDecisions.ReportAppServer.ClientDoc

I've looked at similar questions on SO, but nothing quite matches my issue as far as I can tell.

The exception message:

Could not load file or assembly 'CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.

The file is in my GAC. I am developing on a 32 bit machine (Windows 7) running VS2010, everything is .NET4. The target hosting machine is 64-bit Win 2008 R2. My local machine has the CR installation for VS2010; the hosting machine has the 64-bit runtimes for VS2010. I am compiling all my code in "Any CPU" mode for this web application.

It is blowing my mind that it cannot find the file in the GAC. This is an IIS application; is there some sort of permissions issue? I would think IIS would have access to the GAC.

Some suggestions of what to do would be appreciated.


Source: (StackOverflow)

Advertisements

CrystalReport Load report failed

I have a windows application project (C# and .NET 2.0) that used Crystal Report 2008. But I get error sometimes (it seems accidentally) in loading report. That error is:

CrystalDecisions.Shared.CrystalReportsException: Load report failed.
System.Runtime.InteropServices.COMException (0x8000020D): Unable to load report.
   at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
   --- End of inner exception stack trace ---
   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
at SIA.DataTransfer.Forms.frmReport.GetStateReport(Int32 transferType)

please guide me. How can I solve this problem?


Source: (StackOverflow)

Label printer starts printing blank pages in large jobs

I'm running into an extremely strange issue that a user of mine is reporting: A Crystal Reports report is printing blank pages past a certain point. My troubleshooting has sort of narrowed down the culprit, but at the same time, has displayed some inconsistent results.

Here's the lowdown:

  • The application is a VB.NET application, using .NET 4.
  • There are multiple Crystal Report reports embedded in the solution, and a single form is used to display and print any report.
  • Which report to display is handled through the code backend, and assigned to the form's CrystalReportViewer object before showing the form.
  • For the problem report, the datasource comes from a SQL query run in the code, and then assigned as the report's datasource, and then the report is assigned as the reportsource for the CRV object in the form.
  • The label printer is attached via USB to the computer in question, with the installer used to provide the drivers.
  • If it matters, it's a Citizen CLP-7201e label printer.

The code that assigns the datasource to the report is as follow:

    myCommand = New SqlClient.SqlCommand(strSQL, conPlanning)
    myCommand.ExecuteNonQuery()

    Da = New SqlClient.SqlDataAdapter(myCommand)

    Da.Fill(dsData, "TempPrintLabels")

    rptPrintLabels.SetDataSource(dsData.Tables(0))
    rptPrintLabels.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait

    frmReports.rptViewer.ReportSource = rptPrintLabels

    frmReports.Show()

strSQL is a basic SQL statement, based on which report is selected from this particular form. The report's SQL query is, SELECT * FROM TempPrintLabels.


There's the basic info. The report generates fine, and for reports with ~100 labels, it prints fine. The strangeness happens when the report exceeds that limit; it's somewhere in the 95-120 label range. It doesn't seem to be consistent. The report will print, up until it hits that certain point. At that time, it will print nothing but blanks for the rest of the report. There will be as many blanks as there are supposed to be remaining pages. If you start the job again at the point where the blanks started, though, it prints fine.

When I look at this report in the CrystalReportViewer, it looks fine; all the labels render properly. When I print it to a PDF or text file printer, all the pages are there. So the report and print generation seems to be working to me.

I thought it was the printer. To test that, I printed a 185 page job to PDF, and then printed that to the printer. That printed absolutely fine.

I'm at a loss to explain this, or even diagnose this further. There is no code in the form for printing; it uses the CrystalReportViewer object to handle everything. If it was this CRV object, the printing to PDF should've given me blank pages. It didn't. If it was the printer, it should have started printing blanks from the PDF right around the same point as printing directly from the CRV object did. It didn't.

What else can I look for?


Source: (StackOverflow)

Why does Crystal Report Viewer always asks for login details to Access database on WePOS operating system?

I wrote a report using Crystal Reports XI linked to an Access database here C:\MyData.mdb.

The report has one field (simplified for this example) and no sub-reports.

I have used the Forms and WPF Cyrtsal Report Viewer using C# .NET 4.

The report views successfully on my development PC running Windows XP, and on other "tills", also running Windows XP.

However, on a till running WePOS (a sort of cut down Windows XP) the report "always" shows a dialog box asking for login details i.e. Username & Password.

This dialog box also shows the correct path to C:\MyData.mdb.

I have spent many days on this, testing in every way possible (I'm sure everyone remembers times like these!).

I use this code to ensure the database is correctly linked to:

TableLogOnInfo logonInfo;

foreach (CrystalDecisions.CrystalReports.Engine.Table table in report.Database.Tables)
{
    logonInfo = table.LogOnInfo;
    logonInfo.ConnectionInfo.ServerName = string.Empty;
    logonInfo.ConnectionInfo.DatabaseName = "C:\MyData.mdb";
    logonInfo.ConnectionInfo.UserID = string.Empty;
    logonInfo.ConnectionInfo.Password = string.Empty;
    table.ApplyLogOnInfo(logonInfo);
}

... and it works on every PC with Windows XP, except the one with WePOS.

I've also played with:

report.SetDatabaseLogon(string.Empty, string.Empty, "C:\MyData.mdb", string.Empty);

... but It makes no difference.

  1. There is no username or password on the Access database
  2. All the PC's used have the releveant software installed (runtimes, etc.)
  3. All the PC's were tested using the Adminstrator account (and file permissions were double checked)
  4. I've tried ticking the Integrated Security tick box, with no luck
  5. I set logonInfo.ConnectionInfo.DatabaseName = string.Empty;
  6. I set logonInfo.ConnectionInfo.ServerName = "C:\MyData.mdb";
  7. I have tried NOT using any of the above code, instead just made sure the database was in the same place on all PC's, with no luck
  8. It is an Access 2003 database file

I can only conclude WePOS is so "cut down" that Crystal is silently failing to pass authentication... please help!


Source: (StackOverflow)

Padding a fixed number with leading zeros up to a fixed length [closed]

In Crystal Report using Visual Studio 2010, I am trying a to create a formula for the following scenario:

x = any number (Fixed number of 8 digits, cant be less or greater)

If Length of X is less than 8, pad the required amount of 0's in the front to make its length 8.

Eg:

X = 123
Result of Formula should be 00000123

X = 9
Result of Formula should be 00000009

Any help will be appreciated. Thanks in advance.


Source: (StackOverflow)

Crystal Reports vs ReportViewer Pros/Cons? [closed]

We have been designing our reports around Crystal Reports in VS2008 for our web application and I just discovered the Microsoft provided ReportViewer control. I've searched around a bit but cannot find a good breakdown of the pros and cons of each method of producing reports.

I'm looking for pros and cons regarding:

  • Ease of development
  • Ease of deployment
  • Ability to export data
  • Ease of support and finding help on the web

Source: (StackOverflow)

Cannot open .rpt Crystal Reports file in Visual Studio 2010

I have taken over an existing C# project and am using Visual Studio 2010 with .NET framework 4.0.

The application uses Crystal Reports. It seems like the definitions of the reports lie in a separately located folder containing many .rpt files.

When I run the application, some of these reports work and others don't. I now want to debug the reports that don't work and also want to add some new Crystal Reports.

Problem is, whenever I try to open one of the .rpt files in Visual Studio I get gibberish - it looks like binary code.

For information: I already know that Crystal Reports does not come standard with Visual Studio 2010. I have therefore already installed SAP Crystal Reports, version for Visual Studio 2010 - Click Once (64 Bit) from the location http://www.businessobjects.com/jump/xi/crvs2010/us2_default.asp as was suggested in Creating a Crystal Reports rpt file using Visual Studio 2010 and http://social.msdn.microsoft.com/Forums/en-US/vscrystalreports/thread/fb6d3588-1481-46a2-8284-90dbb40c42f6

Did I install the wrong thing or am I missing a dependency? The .rpt files are not part of the Visual Studio project. They are separate files in a folder. How do I go about opening them so that I can perform edits in Visual Studio?


Source: (StackOverflow)

Crystal Reports for Visual Studio 2010 Error

I am trying to run a crystal report from my web application which was built using ASP.NET 4.0 and Visual Studio 2010. I have installed the following from the SAP site (http://www.businessobjects.com/jump/xi/crvs2010/us2_default.asp)

1) SAP Crystal Reports, version for Visual Studio 2010 - Standard EXE installation package which installs the software into the Visual Studio IDE.

2) SAP Crystal Reports runtime engine for .NET Framework 4 (64-bit)

I have a page called Reports.aspx in which I have a crystal report viewer control

 <CR:CrystalReportViewer ID="rptViewer" runat="server" AutoDataBind="true" />

In the Reports.aspx.cs file I have the following code:

protected override void OnPreRender(EventArgs e)
{
    ReportDocument report = new ReportDocument();
    var path = Server.MapPath("Reports/Sample.rpt");
    report.Load(path);
    report.SetDatabaseLogon("username", "password", "servername", "databasename");
    rptViewer.ReportSource = report;
}

On the report.Load(path) line I get the following error:

Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack.

How can I fix this?


Source: (StackOverflow)

Crystal Reports error when deployed..Could not load file or assembly 'log4net

Please help. I have a web application that was built in VS2010 and we are using the CR plugin for 2010 and everything works perfect on our local machines. When we go to deploy the web application to Server 2008 the application runs fine until we try to get to a report. When we get to a report we receive...

Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified. 

We have installed the CR2010 runtimes and the file log4net.dll version 1.2.10.0 is in the GAC so we are not referencing it in the application. When we add it as a reference we get this error no matter where we are in the application, not just on the report pages. Please help!


Source: (StackOverflow)

Could not load CrystalDecisions.ReportAppServer.ClientDoc

Could not load file or assembly 'CrystalDecisions.ReportAppServer.ClientDoc, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.


I just deployed our web app to a new server that uses the Crystal Report viewer in several reports in our ASP.NET 3.5 app. I have all the DLLs CR requires or so I think, in the BIN folder but I am still running into this error. I've never used CR before so do I need to install anything on the server for the reports to work? This is straight out of VS2008.


Source: (StackOverflow)

Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack [duplicate]

This question already has an answer here:

when i deploy my asp.net website on windows server 2003 with oracle 10g database in backend.I am using sap crystal report version 13.0.2000.0 It gives error as

Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ 
stack.Description: An unhandled exception occurred during the execution of the current web request.
Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[COMException (0x80041811): Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack.]
CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) +95
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +270

[CrystalReportsException: Load report failed.]
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +333
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) +877
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename) +84
WEBPAGES_srccustomerbill2.setdatasource() +2270
WEBPAGES_srccustomerbill2.Page_Load(Object sender, EventArgs e) +233
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1


Source: (StackOverflow)

Crystal Reports and Visual Studio 2013 preview

I just installed VS2013 preview and the integration of Crystal Reports is not working. I installed "Crystal Reports for Visual Studio V13.0.6", this provides integration in VS2012.

Is there any hack/trick to integration CR into VS2013preview, so that I can edit reports?


Source: (StackOverflow)

Crystal Reports 13 And Asp.Net 3.5

I'm developing a website using Asp.Net 3.5 in Visual Studio 2008 and we use Crystal Reports 10 (that's come together vs2008). Last Year, We migrate it to Visual Studio 2010 but we still use .Net 3.5 in our website. Vs2010 does not come with Crystal Reports, so we download Crystal 13 (for vs2010) from SAP business object and install in my develop machine (Sdk kit and runtime). It works fine, we changed the references in web.config from Crystal 10 to Crystal 13 and it's working in our develop machine. We still using Asp.Net 3.5. Now the problem... I host my website in our server (I also install the runtime) and I get this exception with a message:

"Could not load file or assembly 'CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified."

In web.config the exception:

Can anybody help me ? Is possible use .Net 3.5 with Crystal 13 ? Or other solution (version) for Crystal?

Thank you!

Edits

<compilation debug="false" strict="false" explicit="true">
    <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
    </assemblies>
      <buildProviders>
      <add extension=".rpt" type="CrystalDecisions.Web.Compilation.RptBuildProvider, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
  </buildProviders>
</compilation>  

Source: (StackOverflow)

Printing on roll paper

I am using C# with Winforms. I am trying to print bills on a paper roll. The width of the paper is 3in but the length of the paper is dynamic (its a roll paper). The length depends on how many items are there in the list. E.g. in a purchase if there are 100 items sold then it will be quite long roll while for a single item purchased it would be of small length.

When I print the report, after the end job, printer eject the last page more than I need. It eject paper as long as A4 size. I want to print the required lines, then stop printing. I use a roll of paper, not A4 or A3 and an Epson LQ-300 + II printer.

To be more specific, printing is always done to page-sized units. If I set the page to be 3in x 8in then I always end up with a printout that is a multiple of 8in long. If I have a 9in bill to print, I end up with a 16in printout, wasting 7in of paper. How can I print with the last page being only as long as it needs to be?

Here is the code:

private void printDoc_PrintPage(Object sender, PrintPageEventArgs e)
        {
            Font printFont = new Font("Courier New", 12);
            int y = 15;
            e.Graphics.DrawString("a Line", printFont, Brushes.Black, 0, y); y = y + 20;
            e.Graphics.DrawString(" Line", printFont, Brushes.Black, 0, y); y = y + 25;
            e.Graphics.DrawString(" Line", printFont, Brushes.Black, 0, y); y = y + 35;
            e.Graphics.DrawString(" Line", printFont, Brushes.Black, 0, y); y = y + 45;
        }

Source: (StackOverflow)