none
Pass date range parameters RRS feed

  • General discussion

  • hello experts,

    i have prepared a Daily Sale reports which shows sales between the given date, i have set the report language to en-Gb,

    my local & server machines language is set to en-UK, in the sql bussiness intelegence report project i can see the repoprt properly

    the query for dataset is having @fromdate & @todate , i have set @fromdate , @todate as datetime parameters

    when i see the report preview in development mode i see things correct

    but when i call this report from c#.net winform, where i collect the user supplied @fromdate & @todate & pass it to reportviewer

    using following commands

    rdlPreview1.myConnectString =

    Appvaribales.ConnectionString;

    rdlPreview1.MyReportPath =

    System.Collections.

    arlNames.Add(

    arlNames.Add("todt");

     

    this.rdlPreview1.RdlParameterNames = arlNames;

     

     

    arlValues.Add(fdt);

    arlValues.Add(edt);

     

    rdlPreview1.exeReport();

    i get the error, saying date conversion failed,

    can somebody help me to solve this problem

    DateTime fdt = dtpFrom.Value; DateTime edt = dtpto.Value; this.rdlPreview1.RdlParameterValuse = arlValues;
    RDLFactory.SetRDLPath("ppsale.rdl"); ArrayList arlNames = new System.Collections.ArrayList();
    "fromdt");
    • Edited by Sushil Agarwal Friday, March 11, 2011 6:14 PM typing error
    Friday, March 11, 2011 6:11 PM

All replies

  • What I would do is debug the value of dates and see what format they are coming up. That could be done at this point:

    arlNames.Add( "todt" );

     //check todt value here. and possible apply culture conversion in case date formats are different.

    this .rdlPreview1.RdlParameterNames = arlNames;


    http://dailyitsolutions.blogspot.com/
    Sunday, March 13, 2011 7:24 AM
  • Thanks umir for your valuablt time,

    meanwhile i had changed the parameters as

    arlNames.Add(

    "doc_gl");

    arlNames.Add(

    "finyear");

    arlNames.Add(

    "plantid");

    arlNames.Add(

    "fromdt");

    arlNames.Add(

    "todt");

    arlValues.Add(doc_gls);

    arlValues.Add(finyear);

    arlValues.Add(

    ErpMdi.ID);

     

    // pass the parametes as "yyyy/MM/dd" only

    arlValues.Add(dtpFrom.Value.ToString(

    "yyyy/MM/dd"));

    arlValues.Add(dtpto.Value.ToString(

    "yyyy/MM/dd"));

    this could solve the problem, also i had set the fromdt,todate parameters in ppsale.rdl as text.

    but my question is, if in an rdl i set the report parameters as date/time and i send arlValues.add(dtpFrom.Value) [ i checked in debug it is showing properly dd/mm/yyy] both in rdl/c# what is the reason the conversion fails error comes while runnig the report

     

    Monday, March 14, 2011 9:17 AM
  • it was the problem with gotreports rdl viewer which i was using to show local report using server reports ( .rdl),

    i modified  the gotreport rdl viewer and now it is working correctly.

    Thursday, August 9, 2012 9:33 AM