Partager via


Passing non-English parameters to reporting services via URL access

Few weeks ago I faced a problem when I was using SQL Server Reporting Services to generate a report in which all parameters' values in Arabic.

The problem appeared when I used this report through URL access, and passed the parameters' values throug URL. I did a simple report to reproduce the problem. Let's say I have a report like this

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="https://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition" xmlns:rd="https://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<rd:GridSpacing>0.25cm</rd:GridSpacing>
<RightMargin>2.5cm</RightMargin>
<Body>
<ReportItems>
<Textbox Name="textbox1">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<rd:DefaultName>textbox1</rd:DefaultName>
<Height>0.63492cm</Height>
<Width>6.75cm</Width>
<Top>0.25cm</Top>
<CanGrow>true</CanGrow>
<Value>=Parameters!CustomerName.Value</Value>
<Left>1.5cm</Left>
</Textbox>
</ReportItems>
<Style />
<Height>5cm</Height>
<ColumnSpacing>1cm</ColumnSpacing>
</Body>
<TopMargin>2.5cm</TopMargin>
<Width>16cm</Width>
<LeftMargin>2.5cm</LeftMargin>
<rd:SnapToGrid>true</rd:SnapToGrid>
<PageHeight>29.7cm</PageHeight>
<rd:DrawGrid>true</rd:DrawGrid>
<PageWidth>21cm</PageWidth>
<rd:ReportID>573728dc-7d8a-4652-8a69-3a9c1a55887b</rd:ReportID>
<BottomMargin>2.5cm</BottomMargin>
<ReportParameters>
<ReportParameter Name="CustomerName">
<DataType>String</DataType>
<AllowBlank>true</AllowBlank>
<Prompt>CustomerName</Prompt>
</ReportParameter>
</ReportParameters>
<Language>en-US</Language>
</Report>

When you call this report through URL access and pass the parameter CustomerName like this

&rs:Command=Render&rc:parameters=false&CustomerName=عمر

You note that the report doesn't recognize the parameter value passed. The report considers it as empty string.

 

To avoid this I found in Service Pack 2 documentation that you need to add this parameter rs:ParameterLanguage=<culture> so in my case I should add rs:ParameterLanguage=ar-EG

I tried this but It didn't solve the problem. I tried another way and it solved my case, I URL encoded my parameters values before passing them to the report.

If you are using web application and you want to show a report. You can use Server.URLEncode("<parameter value>") .

If you are using windows application, you need to reference System.Web.dll assembly and use HttpUtility.UrlEncode("<parameter value") (it's static/shared method).

I hope this help who may face the same probelm.

Comments

  • Anonymous
    October 04, 2005
    Can you tell me how to pass parameters for a report. i am a new comer in sql reporting services and i want to know how to pass any parameters . say like select * from table 1 where startdate=@startdate..kind of. how can i do that

  • Anonymous
    March 16, 2006
    I've got a report which drills through to a pop-up page which contains an IFRAME pointing at the destination report (using URL access parameters to Reporting Services.) I wanted to pass the destination report URL as a querystring parameter in the hyperlink action of a textbox to my popup page (e.g. popuppage.aspx?ReportURL=http://reportserver/report?param1&param2&etc.) My pop-up page then uses this ReportURL property to set the src of the IFRAME. If you pass the URL without encoding it the destination the querystring gets broken up so I added some custom code to URL encode the link and works a dream but I wish it was a lot easier to do this sort of stuff in Reporting Services, just feels like a bit of a cludge.

  • Anonymous
    April 03, 2006
    Hi YelloBook,
       You can simple use HttpUtility.UrlEncode() function to solve this problem.

    Thansk,
    //Mohamed

  • Anonymous
    January 28, 2007
    It will be kind of you to help me I use Server.URLEncode("<parameter value>") but the report doesn't recognize the parameter value passed. The report considers it as empty string.

  • Anonymous
    May 09, 2007
    System.Web assembly  for windows application does not contain httpUtility class. please help...

  • Anonymous
    May 09, 2007
    please ignore my pevious post, it's working fine..:)

  • Anonymous
    September 18, 2007
    How can i pass parameter to my report parameter... This is in windows application... eg:Application.Try(Parameters!Language.Value) how can i pass the value to Parameters!Language.Value from other .cs file

  • Anonymous
    November 15, 2007
    Can I pass a parameter like this: WHERE Description LIKE @Description?

  • Anonymous
    August 06, 2008
    Thanks a lot... i have been browsing for windows application... its working fine

  • Anonymous
    August 24, 2008
    How to show a report of reporting services from windows applications ?