Click here to Skip to main content
12,625,960 members (25,756 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: CrystalReports
Hi,

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();
obj1.Load(@"C:\Projects\Restaurant.UI\InvoiceDetails.rpt");
 
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;
objReport.Show();
Posted 17-Jan-13 19:49pm
Updated 18-Jan-13 6:01am
Kschuler35.1K
v2
Comments
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
 
good
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[^]
  Permalink  
Rate this: bad
 
good
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
  Permalink  

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 | Mobile
Web02 | 2.8.161205.3 | Last Updated 31 Oct 2013
Copyright © CodeProject, 1999-2016
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