Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

SSRS 2012 rendering report as PDF does not honor parameters?

$
0
0

Hello friends

SS2012 (SP1)

I have very simple report that accepts two parameters and display the info about the employee ( one pic and some text). So far so good, now we have a requirement to generate directly to PDF that report and here we have  problems. If I specify hardcoded values (picture path  and ip address) that works fine but if I try to provide a parameter then the picture of the employee is not displayed. Can anyone shed some light what I  am missing here? We declared the image as External  that accepts a parameter @Imagepath

Ps. We tried declare the image as database/ embedded  and provide parameter but that did not work as well.

Imports System.IO

Imports Microsoft.Reporting.WinForms

Imports Microsoft.SqlServer.ReportingServices2005

PrivateSub CreatePdfFile()

       Dim ImagePath As String = ""

       Dim Res As New Execution.ReportExecutionService

        DimCurEmpId as string ="14154"

       Dim ReportPath AsString = "/EmpAssessment/EmpAssesment"

       Dim Params(1) As Execution.ParameterValue

        FilePath ="C:\EmpAss\"& CurEmpId & ".PDF"

       Try

            ImagePath ="\\servename\Pictures\"& CurEmpId &".jpg"

       Catch

           Try

                ImagePath ="\\servername\Pictures\Empty.jpg"

           Catch ex As Exception

           EndTry

       EndTry

       Dim FileImage As String = "file:"& ImagePath

       Dim p(1) As Microsoft.Reporting.WinForms.ReportParameter

       Dim Format_ As String = "PDF"

       Dim DevInfo As String = Nothing

       Dim Extension As String = Nothing

       Dim MimeType As String = Nothing

       Dim Encoding As String = Nothing

       Dim Warnings() As Execution.Warning =Nothing

       Dim StremIds() AsString = Nothing

       Dim Result() As Byte = Nothing

        Res.Credentials = System.Net.CredentialCache.DefaultCredentials

        Res.Url ="http://ssrsserver/ReportServer/ReportExecution2005.asmx?wsdl"

       

        Params(0) =New Execution.ParameterValue

        Params(0).Name ="ImagePath"

        Params(0).Value = FileImage

        Params(1) =New Execution.ParameterValue

        Params(1).Name ="Ip"

        Params(1).Value = IP_ADD

        Res.LoadReport(ReportPath,Nothing)

        Result = Res.Render(Format_, DevInfo, Extension, MimeType, Encoding, Warnings, StremIds)

        IO.File.WriteAllBytes(FilePath, Result)

    EndSub


Best Regards,Uri Dimant SQL Server MVP,http://sqlblog.com/blogs/uri_dimant/

MS SQL optimization: MS SQL Development and Optimization
MS SQL Blog: Large scale of database and data cleansing
Remote DBA Services: Improves MS SQL Database Performance


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>