Export Report in Visual Studio 2005 don't show stored procedure parameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mariana
    New Member
    • Oct 2006
    • 1

    Export Report in Visual Studio 2005 don't show stored procedure parameters

    Hello,
    I am exporting reports in pdf format from .net 2005 . The export is working fine; however the user values of stored procedure parameters does not show in the report. What do I need to do in order to see the parameters value in the report?

    The report has a report parameter "reportTitl e" and i see the value in the report.
    It has also another 2 stored procedure parameters @BeginDate and @EndDate.
    The values are entered be the user; however in the report those values don't appear.


    I used the following code:
    [HTML]
    //load the report
    crReportDocumen t = new CrystalDecision s.CrystalReport s.Engine.Report Document();
    crReportDocumen t.Load(Server.M apPath("\Report s\Production.rp t") ;
    // set logins for the crystal report
    Utilities.SetLo gons(crReportDo cument);
    Hashtable reportParamsHas h = ((Hashtable)Ses sion["ReportParamsHa sh"]);
    foreach (String keyParamName in reportParamsHas h.Keys)
    {
    Utilities.SetPa ram(crReportDoc ument, keyParamName, reportParamsHas h[keyParamName].ToString());
    }
    // export report
    Utilities.Expor tToPDF(crReport Document, Server.MapPath( fileName));

    // function that sets report parameters values
    public static void SetParam( ReportDocument crReportDocumen t, string ParamName, object ParamValue)
    {
    //set the parameter value
    crReportDocumen t.SetParameterV alue(ParamName, ParamValue);
    }
    // function to export the report
    public static void ExportToPDF(Rep ortDocument Report, string file)
    { ExportToDisk(Re port, file, ExportFormatTyp e.PortableDocFo rmat);
    }
    private static void ExportToDisk(Re portDocument Report, string fileName,Export FormatType expFormat)
    {
    DiskFileDestina tionOptions diskOpts = ExportOptions.C reateDiskFileDe stinationOption s();

    ExportOptions exportOpts = new ExportOptions() ;
    exportOpts.Expo rtFormatType = expFormat;
    exportOpts.Expo rtDestinationTy pe = ExportDestinati onType.DiskFile ;

    diskOpts.DiskFi leName = fileName;
    exportOpts.Expo rtDestinationOp tions = diskOpts;

    Report.Export(e xportOpts);

    }


    [/HTML]
    Can anybody help?
    Thank you,
    Mariana
Working...