Setting SSRS Parameters in C#

by ebarcza 2/18/2011 5:02:00 AM

Example of how to set parameters via code behind for an SSRS rdl report

        ReportExecutionService rs = new ReportExecutionService();
        rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
        rs.Url = "http://ServerName/reportserver/ReportExecution2005.asmx";

        ExecutionInfo execInfo = new ExecutionInfo();
        ExecutionHeader execHeader = new ExecutionHeader();

        rs.ExecutionHeaderValue = execHeader;

        execInfo = rs.LoadReport(reportPath, historyID);
        //execInfo.Parameters[0].
        ParameterValue prmCompanyID_1 = new ParameterValue();
        prmCompanyID_1.Name = "iCompanyID";
        prmCompanyID_1.Value = "276";

        ParameterValue prmCompanyID_2 = new ParameterValue();
        prmCompanyID_2.Name = "CompanyID";
        prmCompanyID_2.Value = "276";

        ParameterValue prmProdMonth = new ParameterValue();
        prmProdMonth.Name = "ProdMonth";
        prmProdMonth.Value = "12";

        ParameterValue prmProdYear = new ParameterValue();
        prmProdYear.Name = "ProdYear";
        prmProdYear.Value = "2010";

        ParameterValue[] prmList = new ParameterValue[4] { prmCompanyID_1, prmCompanyID_2, prmProdMonth, prmProdYear };

        rs.SetExecutionParameters(prmList, "en-us");

Tags: , ,

SQL Server Reporting Services

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail

Calendar

<<  January 2018  >>
MoTuWeThFrSaSu
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

Recent comments

Tags

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2018

Sign in