cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports problem in VS19

Hello,

I'm working in Visual Studio 2019 and the app is working fine except when I try to export a report, I get an error:

Method not found: 'Void CrystalDecisions.ReportAppServer.ReportDefModel.PDFExportFormatOptionsClass.set_CurrentPageNumber(Int32)'.

I have tried many different solutions but nothing seems to work.

Help would be very much appreciated.

Thank you in advance!

Damad

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Ok, so I've fixed the issue.

If anyone runs into this issue, please make sure that your datasource in the report is correct. In our case it was still connected to the old database and that was the problem. Once changed, it worked fine.

Answers (7)

Answers (7)

0 Kudos

Yes, You need the same DB client installed on the App server where CR runtime is as the report was created with.

CR is simply passing the DB error code to you from the DB.

0 Kudos

mmm, just confirmed it works for me.

Try a report without parameters and see if that works.

You can't get any more simpler than this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Init(object sender, EventArgs e)
    {
        CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new ReportDocument();
        rpt.Load(@"c:\reports\World Sales Report.rpt");
        CrystalReportViewer1.ReportSource = rpt;
        rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "ExportedReport");

    }
}
0 Kudos

After I installed some missing NU packages, the error seems to have been resolved. But another error occurred.

Error in File CrystalReport1 9888_912_{99CAF4EF-BE20-4757-A030-9167F3F6F2E4}.rpt:
Unable to connect: incorrect log on parameters.
Details: [Database Vendor Code: 18456 ]

Because the database is working on the rest of the project and in the form that I use to create report, I'm not sure what to do.

0 Kudos

CrystalDecisions.CrystalReports.Engine.LogOnException: 'Database logon failed.'

After I deleted rpt file used and inserted the original one, that's the only thing I got.

0 Kudos

Is it required to have MS SQL Server Native Client on the server ?

0 Kudos

See if this works:

#region PDF
{
    // This works do not alter
    // this gets the report name and sets the export name to be the same less the extension
    string outputFileName = "";
    string MyRptName = rpt.FileName.ToString();
    outputFileName = MyRptName.Substring(9, rpt.FileName.Length - 9);
    outputFileName = outputFileName.Substring(0, (outputFileName.Length - 3)) + "pdf";

    try
    {
        if (File.Exists(outputFileName))
        {
            File.Delete(outputFileName);
        }

        CrystalDecisions.ReportAppServer.ReportDefModel.PDFExportFormatOptions RasPDFExpOpts = new PDFExportFormatOptions();

        try
        {
            RasPDFExpOpts = rptClientDoc.get_SavedExportOptions(CrReportExportFormatEnum.crReportExportFormatPDF);
        }
        catch (Exception ex)
        {
            btnSQLStatement.Text = "ERROR: " + ex.Message;
            //return;
        }

        // Set them now:
        //RasPDFExpOpts.CreateBookmarksFromGroupTree = false;
        //RasPDFExpOpts.EndPageNumber = 1;
        //RasPDFExpOpts.StartPageNumber = 1;

        // Save the udpated info
        if (RasPDFExpOpts != null )
            rptClientDoc.set_SavedExportOptions(CrReportExportFormatEnum.crReportExportFormatPDF, RasPDFExpOpts);

        CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions exportOpts1 = new CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions();
        exportOpts1.ExportFormatType = CrReportExportFormatEnum.crReportExportFormatPDF;
        exportOpts1.FormatOptions = RasPDFExpOpts;

        // And Export
        rptClientDoc.PrintOutputController.ExportEx(exportOpts1).Save(outputFileName, true);
        MessageBox.Show("Export to PDF Completed", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }
    catch (Exception ex)
    {
        btnSQLStatement.Text = "ERROR: " + ex.Message;
        return;
    }
    // This works do not alter
    }
#endregion PDF
0 Kudos

This doesn't work. Most of the things in the code are red and even when resolved, still leaves the issue of rptClientDoc being out of context.

Out app is .NET app and we're suppose to create a report based on taking data off of database.

0 Kudos

string filePath;

ReportDocument rd = new ReportDocument();

filePath = Request.ServerVariables["APPL_PHYSICAL_PATH"];

rd.Load(filePath + "CrystalReport1.rpt");

rd.SetDatabaseLogon("user", "password", "server", "database");

rd.SetParameterValue("ProgramId", Convert.ToInt32(DropDownList1.SelectedValue));

rd.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "ExportedReport");

.

.

.

.

That's the code that we have, and the error I mentioned occurs in the last line of the code. It worked on the old server but doesn't on the new one.

0 Kudos

Also, when we tried ExportToDisk method, the same error happened.

0 Kudos

Look for access denied errors in the PM log.

Does it work for any other format?

Look in the install log and see if anything failed:

C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\logging

Do you have Adobe Reader installed on the Server? It is required.

Don

0 Kudos

I've checked for access denied errors and there are none.

It's not working for any format.

Nothing failed during the installation.

We have installed Adobe Reader on you suggestion but it didn't fix the problem.

0 Kudos

Did you install the SP 25 MSI package on the Server.

Use Process Monitor to see where the error is being generated.

0 Kudos

We have SP 25 MSI package on the Server, as far as Process Monitor goes, it's not giving us anything comprehensible.

name.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "ExportedReport");

That's the line of code that's throwing an exception or error, where "name" is ReportDocument.

Error keeps occurring regardless of what we try.

We have tried reinstalling everything. We tried using different frameworks, but the rest of the project is only working in 4.5 and 4.7.2.

We even tried running the whole solution in VS17, but it didn't help.

We are using log4net but not the latest version because when we use the newest version, it's not allowing us the usage in webconfig file.

Same error occurs in the method ExportToDisk

Any suggestion would be much appreciated.

Thanks in advance.

0 Kudos

It works in the Viewer and I can check it in the solution, but once I run it locally or on a server it won't export it, providing me with he aforementioned error.

I use VS 2019 and it's the latest CR SP25

0 Kudos

What CR for VS SP are you using?

Does it work exporting from the Viewer?