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="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition" xmlns:rd="http://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.

http://blogs.msdn.com/mohamed_sharafs_blog/

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish