27747 total geeks with 3539 solutions
Recent challengers:
 Welcome, you are an anonymous user! [register] [login] Get a yourname@osix.net email address 



User's box

Forgot password?
New account

<ul><li><str ong><a href="http:/ /fr.thewatch man.me/">mé canique suisse mouvement répliques de montres</a>< /strong></li ><li><strong ><a href="http:/ /fr.thewatch man.me/">mon tres</a></st rong></li><l i><strong><a href="http:/ /www.thewatc hman.me/fr/" >montres</a>
[b][url=http ://pens.nbal anceclassic. com/fr/]Me<s trong><a href="http:/ /pens.nbalan ceclassic.co m/fr/">Meist erstück Montblanc</a ></strong><b r> <strong><a href="http:/ /pens.nbalan ceclassic.co m/">Montblan c</a></stron g><br>
[b]<a href="http:/ /fr.kwon-lab .com/">stylo <strong><a href="http:/ /fr.kwon-lab .com/">stylo s Montblanc</a ></strong><b r> <strong><a href="http:/ /www.kwon-la b.com/fr/">s tylos Montblanc</a ></strong><b r>
[b]<a href="http:/ /www.moncler outletoho.co m/">m<strong ><a href="http:/ /www.moncler outletoho.co m/">moncler sale</a></st rong> <br> <strong><a href="http:/ /www.moncler outletoho.co m/">moncler outlet store</a></s trong> <br>

Donate and help us fund new challenges
Due Date: Nov 30
November Goal: $40.00
Gross: $0.00
Net Balance: $0.00
Left to go: $40.00

News Feeds
The Register
Mr Grey, the
Russian hacker who
helped haul in 1.2
billion logins
NASA pours cold
comets on
utter theory
EU copyright
reforms to be
"gradual, balanced
and targeted", says
Australian cops
rush to stop 2AM
murder of ? a
Oz Govt calls for
more talk on telco
network security
Mobe-maker OnePlus
"fesses up to
flouting USB-C spec
Malvertiser"s spray
Reader"s Digest
stinky feet with
exploit kit
Enterprise vendors
get into the swing
of Black Friday
26,000 Telstra
Cisco boxen open to
device hijacking
Russian nuke plant
operator to build
on-site data centre
London"s Deputy
Mayor On Ditching
NASA Concludes That
Comets, Not Alien
Orbit KIC 8462852
Apple Looks To
Introduce OLED
Displays In iPhone
Models From 2018
Greenwald: Why the
CIA Is Smearing
Edward Snowden
After Paris Attacks
Ubuntu 16.04 LTS
Will Ship With
Linux Kernel 4.4
Japanese Company
Makes Low-Calorie
Noodles Out of Wood
Free Pascal
Compiler 3.0.0 Is
Out; Adds Support
For 16-Bit MS-DOS,
64-Bit iOS
Russians Build
Data Center
Software Freedom
Conservancy Asks
For Supporters
900 Embedded
Devices Share
Hard-Coded Certs,
SSH Host Keys
Article viewer

List parameters from an SSRS (SQL Server Reporting Services) report into an expression.

Written by:bb
Published by:bb
Published on:2006-10-24 07:55:46
Search OSI about Dot.Net.More articles by bb.
 viewed 26343 times send this article printer friendly

Digg this!
    Rate this article :
How to get a list of parameters and their values from an SSRS (SQL Server Reporting Services) report from within an expression of the report. Its a nice way to echo out all parameters a report was run with without having to hardcode and means you can implement standard footers easily.

I found some tips for doing this on James Kovacs' Weblog. But the code wasnt there, so here it is if you wish to implement it. Another useful msdn article is here.

I am using the imported DLL mechanism of writing code for reports (rather than the inline Code section) Simply add this method to an assembly and reference it in your report. Remember to copy the dll to "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\" to test it when previewing from Visual Studio.

To call this function put a TextBox on your report, edit the expression and add the line
=YourDll.DisplayParams(Parameters, "Param1, Param2");

The function for the assembly
using Microsoft.ReportingServices.ReportProcessing.ReportObjectModel;

/// Builds a list of SQL Server Reporting Services Parameters based on a parameter object
/// and a comma delimited string of param names
public static string DisplayParams(Parameters obj, string strParams)
    StringBuilder sbRet = new StringBuilder();
        //parameters in comma delimited list which matches
        //the name of the parameter in the collection.
        foreach (string sParam in strParams.Split(','))
            //the name of the parameter
            sbRet.Append(String.Format("{0}: ", sParam));

            //concat parmaeter values
            if (obj[sParam].IsMultiValue)
                for (int i = 0; i < obj[sParam].Count - 1; i++)
                    sbRet.Append(String.Format("{0} : ",
                sbRet.Append(String.Format("{0}", obj[sParam].Label).Trim());

            //remove any trailing commas
            if (sbRet.ToString().EndsWith(", "))
                sbRet.Remove(sbRet.Length - 2, 2);

                        // seperator for each parameter
                        sbRet.Append("; ");
    catch (Exception)
        return "Error building parameter list";

    return sbRet.ToString();

Did you like this article? There are hundreds more.

Anonymously add a comment: (or register here)
(registration is really fast and we send you no spam)
BB Code is enabled.
Captcha Number:

Blogs: (People who have posted blogs on this subject..)
ASP.NET RadioButton GroupName when inside a Repeater on Sun 10th Jun 8am
I was thankful on finding this nugget of code, which makes the groupname work out when slamming in radiobuttons in an asp.net repeater. http://www.codeguru.com/csharp/csharp/cs _controls/custom/article.php/c12371/

Your Ad Here
Copyright Open Source Institute, 2006