0

I am working on an application, which comes from several migrations. It started in Visual Studio 2010 and Crystal Reports 9 and is now in Visual 2013.

The latest version of the code was lost and I am recovering a backup.

I installed in my local PC Crystal version 13.0.26 for 32 and 64 bits, where I can edit the reports from both Visual Studio 12 and 13, and also run the reports from designer.

This is what I installed:

Installed Dlls

All reports are simple, and receive a parameter to perform a Select to the database.

The parameter is called @ID.

The problem I have is that, when I run it from both Visual Studio, I get a message

Missing Parameter Values

First I thought it was a problem with the version in which the reports were created, but I created a new report and the same thing happens. Even the reports created in this version of Crystal Reports do not receive the parameters.

I think the problem is how the parameters are passed. I think the way to pass it was changed from version 9 to 13. This is what I have configured in web.config and on the page that calls it.

<assemblies>
    <add assembly="CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
    <add assembly="CrystalDecisions.Shared, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
    <add assembly="CrystalDecisions.ReportSource, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
    <add assembly="CrystalDecisions.ReportAppServer.Controllers, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
    <add assembly="CrystalDecisions.ReportAppServer.DataDefModel, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
    <add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
    <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
  </assemblies>

This is my .aspx webform markup:

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"   AutoEventWireup="true" CodeFile="REPVisitasDiariasTecnicos.aspx.cs" Inherits="REPVisitasDiariasTecnicos" %>
<%@ Register TagPrefix="CR" Namespace="CrystalDecisions.Web" Assembly="CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
    <div>
        <table style="width: 100%">
            <tr>
                <td>
    <CR:CrystalReportViewer ID="CrystalReportViewer" runat="server" 
        AutoDataBind="true" 
        EnableDatabaseLogonPrompt="False" EnableParameterPrompt="False" 
        ToolPanelView="None" HasToggleGroupTreeButton="False" HasToggleParameterPanelButton="False" 
        DisplayStatusbar="False" HasCrystalLogo="False" HasDrilldownTabs="False" 
        HasDrillUpButton="False" HasGotoPageButton="False" HasZoomFactorList="False" 
        />
                </td>
            </tr>
        </table>
    </div>
    <br />
</asp:Content>

And this is my code behind file:

private void ConfigureCrystalReports()
{
        oReport = new ReportDocument();
        string reportPath;
        reportPath = Server.MapPath(@"report.rpt");

        oReport.FileName = reportPath;
        // establish the connection

        string _connectionString = ConfigurationManager.ConnectionStrings["WEB"].ConnectionString;
        System.Data.SqlClient.SqlConnectionStringBuilder SConn = new System.Data.SqlClient.SqlConnectionStringBuilder(_connectionString);

        // establish the connection with the report
        ConnectionInfo connectionInfo = new ConnectionInfo() { ServerName = SConn.DataSource, DatabaseName = SConn.InitialCatalog, UserID = SConn.UserID, Password = SConn.Password };
        CrystalReportViewer.ReportSource = oReport;
  
        foreach (CrystalDecisions.CrystalReports.Engine.Table t in oReport.Database.Tables)
        {
            TableLogOnInfo boTableLogOnInfo = t.LogOnInfo;
            boTableLogOnInfo.ConnectionInfo = connectionInfo;
            t.ApplyLogOnInfo(boTableLogOnInfo);
        }
    
        ArrayList arrayList = new ArrayList();

        // Add the parameter to a Lisst
        arrayList.Add(31302);
   
        ParameterFields parameterFields= CrystalReportViewer.ParameterFieldInfo;
        SetCurrentValuesForParameterField(parameterFields, arrayList);
    }

    private static void SetCurrentValuesForParameterField(ParameterFields  parameterFields, ArrayList arrayList)
    {
        ParameterValues currentParameterValues = new ParameterValues();

        int i = 0;

        foreach (object submittedValue in arrayList)
        {
            ParameterDiscreteValue paramValor = new ParameterDiscreteValue();
            ParameterField param = parameterFields[i];

            paramValor.Value = submittedValue.ToString();
            param.CurrentValues.Add(paramValor);
            i++;
        }
}

I read a lot in this blogs, I have no subreports, no linked values.. Just the ID.

I know there are many things to take into account when changing versions.

I can't think of anything else I can set.

Any idea what I am doing wrong?

Thanks

1
  • Since the error is the most important clue you have, does it give you a stack trace and line number(s)? If so start there and work backwards. I'd also consider pausing and going through all the code to gain a thorough understanding of how it works. Commented Feb 17, 2024 at 23:55

1 Answer 1

1

I solved it

reading this post post

I replace this function, where I setting the parameters

SetCurrentValuesForParameterField(parameterFields, arrayList);

for this line

oReport.SetParameterValue(0, 24234);

there parameters are passing using SetParameter in this version oy Crystal Report

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.