How to pass Date range parameter from C# to a ValueRange crystals report -


i have difficulty pass date range c# crystal report.

  • here have 2 value c# form startdate & enddate.
  • and have parameter field name date allow range value in crystal report.

i try make string [] pass 2 value crystal report , prompt error valuerangekind.

                    printdocument pd = new printdocument();                     rpt.printoptions.printername = pd.printersettings.printername;                      rpt.setparametervalue("company", nm);                     rpt.setparametervalue("location", cbxloc.tostring().trim().toupper());                     rpt.setparametervalue("product project", cbxppj.tostring().trim().toupper());                     rpt.setparametervalue("commodity", cbxcommodity.tostring().trim().toupper());                      rpt.setparametervalue("date", new string[]{startdate,enddate}); 

this error message :

parameterfieldexception unhandled:
parameter field current values cannot contain discrete values because valuerangekind property set range.

hope can understand situation.

c#

parameterrangevalue myparameterrangevalue = new parameterrangevalue();  myparameterrangevalue.startvalue = startdate; myparameterrangevalue.endvalue = enddate;  crreport.setparametervalue("date", myparameterrangevalue); 

vb

    dim myparameterrangevalue new parameterrangevalue      myparameterrangevalue.startvalue = startdate     myparameterrangevalue.endvalue = enddate      crreport.setparametervalue("date", myparameterrangevalue) 

you need create parameterrangevalue object, fill in, , pass setter. need pass dates strings (i haven't tried datetime objects don't think work), make sure convert datetime objects string first.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -