Sai Ram

Sai Ram

  • NA
  • 237
  • 116.5k

Crystal Reports

Sep 23 2011 9:07 AM

I created Crystal Reports through sql command with 2 parameters and inserting values through C# programming. For 2nd Parameter i am getting a Discrete Values Dialog Box...


 
ReportDocument rpt=new ReportDocument ();
crystalReportViewer1.ReportSource = rpt; 
ParameterFields paramFields = new ParameterFields(); 
ParameterField pfItemYr = new ParameterField();  pfItemYr.ParameterFieldName = "BuildingName";  // 1st Parameter Name  ParameterDiscreteValue dcItemYr = new     ParameterDiscreteValue();

dcItemYr.Value = comboBox1.Text;  // 1st Parameter value  pfItemYr.CurrentValues.Add(dcItemYr);    
dcItemYr = new ParameterDiscreteValue();


//2nd one
dcItemYr = new ParameterDiscreteValue();
dcItemYr.Value = comboBox2.Text;     
pfItemYr.CurrentValues.Add(dcItemYr);

 
paramFields.Add(pfItemYr);   
crystalReportViewer1.ParameterFieldInfo = paramFields;

rpt.Load(@"C:\Users\Administrator\Documents\Visual Studio 2008\Projects\MyCrysRept\MyCrysRept\CrystalReport1.rpt");
rpt.SetDatabaseLogon("sa", "sa123");
crystalReportViewer1.ShowFirstPage(); 
crystalReportViewer1.Show(); 

 







Answers (1)