Click here to Skip to main content
Rate this: bad
good
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 18:49pm
Edited 18-Jan-13 5:01am
Kschuler32.8K
v2
Comments
Teju MB at 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
0 OriginalGriff 420
1 CHill60 410
2 Sergey Alexandrovich Kryukov 384
3 PIEBALDconsult 235
4 BillWoodruff 190


Advertise | Privacy | Mobile
Web04 | 2.8.141015.1 | Last Updated 31 Oct 2013
Copyright © CodeProject, 1999-2014
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