Click here to Skip to main content
13,254,077 members (65,062 online)
Rate this:
Please Sign up or sign in to vote.
See more:

How to avoid Optional parameter prompt? I tried different methods. In my SP I have given default value as null for all the Parameters.

            InvoiceReport objReport = new InvoiceReport();
            ReportDocument obj1 = new ReportDocument();
            if (rbInvoiceStatus.Checked == true)
                int statusid=Convert.ToInt32(cmbItems.SelectedValue.ToString());
                obj1.SetParameterValue("@InvoiceNo", DBNull.Value);
                obj1.SetParameterValue("@VendorID", DBNull.Value);
                obj1.SetParameterValue("@FromDate", DBNull.Value);
                obj1.SetParameterValue("@Todate", DBNull.Value);
                obj1.SetParameterValue("@InvoiceStatusID", statusid);
            objReport.crystalReportViewer1.ReportSource = obj1;
Posted 17-Jan-13 19:49pm
Updated 18-Jan-13 6:01am
Teju MB 18-Jan-13 3:21am
Please clarify your question more clearly , does it pop up some some parameters? Do you want to avoid those?
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

There're two prompts in Crystal reports,
1. Parameter prompt - Disabling Parameter Prompt Dialog Box in Crystal Reports For Visual Studio[^]
2. Logon prompt - C# Crystal Reports Dynamic Logon parameters[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Use the following code to set the parameter in code file

_objReportDocument = new ReportDocument();
_objReportDocument.SetParameterValue(paramName, paramValue);

then it will not prompt you to enter parameter

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171114.1 | Last Updated 31 Oct 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100