Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8833925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:53:59+00:00 2026-06-14T08:53:59+00:00

I have a report that has two parameters: ponumber and receiptno. I’m trying to

  • 0

I have a report that has two parameters: ponumber and receiptno. I’m trying to call the report from a C# page where the parameter values are passed in via the URL. When I call the report, I get an error “The parameter is incorrect”, but can’t figure out why. I’ve done a variety of code changes based on what I found online, because at first the Report Viewer said there were no parameters, so this approach seems to be better, but doesn’t work.

My code:

string ponumber =  Request.QueryString["ponumber"].ToString();
string receiptno = Request.QueryString["receiptno"].ToString();

    // Put Away Report


    CrystalReportSource CrystalReportSource1 = new CrystalReportSource();
    CrystalReportViewer CrystalReportViewer1 = new CrystalReportViewer();



    ParameterFields paramFields1 = new ParameterFields();
    ParameterFields paramFields2 = new ParameterFields();
    ParameterField paramField1 = new ParameterField();
    ParameterField paramField2 = new ParameterField();
    ParameterDiscreteValue paramDiscreteValue1 = new ParameterDiscreteValue();
    ParameterDiscreteValue paramDiscreteValue2 = new ParameterDiscreteValue();

    paramField1.Name = "@ponumber";
    paramDiscreteValue1.Value = ponumber;
    paramField1.CurrentValues.Add(paramDiscreteValue1);
    paramField1.HasCurrentValue = true;
    paramFields1.Add(paramField1);

    paramField2.Name = "@receiptno";
    paramDiscreteValue2 = new ParameterDiscreteValue();  // <-- This line is added
    paramDiscreteValue2.Value = receiptno;
    paramField2.CurrentValues.Add(paramDiscreteValue2);
    paramField2.HasCurrentValue = true;
    paramFields2.Add(paramField2);

    CrystalReportViewer1.ParameterFieldInfo = paramFields1;
    CrystalReportViewer1.ParameterFieldInfo = paramFields2;

    TableLogOnInfo logOnInfo = new TableLogOnInfo();

    logOnInfo.ConnectionInfo.ServerName =   ConfigurationManager.AppSettings["WarehouseReportServerName"];
    logOnInfo.ConnectionInfo.DatabaseName = ConfigurationManager.AppSettings["WarehouseReportDatabaseName"];
    logOnInfo.ConnectionInfo.UserID = ConfigurationManager.AppSettings["WarehouseReportUserID"];
    logOnInfo.ConnectionInfo.Password = ConfigurationManager.AppSettings["WarehouseReportPassword"];

    TableLogOnInfos infos = new TableLogOnInfos();
    infos.Add(logOnInfo);
    CrystalReportViewer1.LogOnInfo = infos;

    maindiv.Controls.Add(CrystalReportSource1);
    maindiv.Controls.Add(CrystalReportViewer1);
    CrystalReportViewer1.ReportSource = CrystalReportSource1;
    CrystalReportViewer1.EnableParameterPrompt = false;
    CrystalReportSource1.Report.FileName = "Report3.rpt";
    CrystalReportSource1.EnableCaching = false;
    CrystalReportViewer1.DataBind();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:54:01+00:00Added an answer on June 14, 2026 at 8:54 am

    I found another answer on SO that got me over the hump. I replaced 13 lines of code with:

    CrystalReportSource1.ReportDocument.SetParameterValue(0, ponumber);
    CrystalReportSource1.ReportDocument.SetParameterValue(1, receiptno);
    

    Passing Values to a Crystal Report

    Rather than build the collection manually, it looks like the source has a different method to setting parameter values. I suspect my first attempt was to create parameters on the fly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a grid view that has two simple columns, a report number and
I have a problem with CR (version that ships with VS2008). Report has two
I have a report in report services 2005 that has two date fields. The
I have a report that I am trying to get the difference between two
I have a report that needs to get data from two logical areas of
I have a report with two parameters. The second parameter is only relevant if
I have a report page that can display two different reports. So I have
Have a matrix report now that has Position, Hours and Wages for a location
I have a report in InfoView that has in a footer showing the effective
I have a .rdlc report and it has matrix. that matrix has some money

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.