SSRS -parameters sent from VB.NET Code to SSRS reports are not being recognized ,VB.NET and SSRS have different providers in connection string

krishna 466 Reputation points
2021-01-25T11:59:02.687+00:00

We have a VB.NET application from which parameter are passed to SSRS reports with arabic content ,our database is IBM DB2.There are two different connection strings with different providers ,in SSRS we use the below connection string as this is printing arabic text in correct order,if i use IBMDASQL.DataSource.1 provider arabic text is rendered in reverse

Provider=Microsoft OLE DB Provider for DB2;User ID=<your used id>;Initial Catalog=dbsys2;Network Transport Library=TCP;Host CCSID=20420;PC Code Page=1256;Network Address=S44CB295;Network Port=446;Package Collection=VEHICLE;Default Schema=VEHICLE;Process Binary as Character=False;Units of Work=RUW;Default Qualifier=VEHICLE;DBMS Platform=DB2/AS400;Persist Security Info=False;Connection Pooling=True

In VB.NET code we use this connection string ,this is a legacy application and i cannot change the provider for this as in SSRS

<add name="ConnStr" connectionString="Provider = IBMDASQL.DataSource.1;Persist Security Info = True;Data Source = SYSPRD01;Default Collection = VEHICLE;Convert Date Time To Char = FALSE;Use SQL Packages = False;Add Statements To SQL Package = False;User ID = <your user id>; Password =<your password>" />

When I try to pass parameters from VB.NET code to SSRS I get the below error

“This report requires a default or user-defined value for the report parameter 'prsFRANCHISE'. To run or subscribe to this report, you must provide a parameter value.” If both connection strings have same provider IBMDASQL.DataSource.1 i am able to render the report succesfully ,only thing is arabic words are in reverse .

I tried to look for setting connection string in vb.net code behind just before i call render report, but there are no methods provided for ServerReport to set connection string

I set parameters using this code

**report.ReportServerUrl = New System.Uri(ldtReportParameter.Rows(0).Item("RMREPTSERV").ToString.Trim)
                report.ReportPath = ldtReportParameter.Rows(0).Item("RMREPTPATH").ToString.Trim
                laIndividualParameters(0) = New ReportParameter("prsFRANCHISE", row.Cells(4).Text.ToString().Trim(), False)
                laIndividualParameters(1) = New ReportParameter("prsBRAN", row.Cells(5).Text.ToString().Trim(), False)
                laIndividualParameters(2) = New ReportParameter("prsDEPT", row.Cells(6).Text.ToString().Trim(), False)
                laIndividualParameters(3) = New ReportParameter("prsPRNO", row.Cells(3).Text.ToString().Trim(), False)
                laIndividualParameters(4) = New ReportParameter("prsCopy", row.Cells(2).Text.ToString().Trim(), False)
                report.SetParameters(laIndividualParameters)
                ServerExport(report)
                lsPrintStatus = Print(row.Cells(9).Text.ToString().Trim(), liNumberofCopies)**

This is my ServerExport method

 Private Sub ServerExport(ByVal report As ServerReport)
    Try

      Dim deviceInfo As String = "<DeviceInfo> <OutputFormat>EMF</OutputFormat> <PageWidth>8.5in</PageWidth> <PageHeight>11in</PageHeight> <MarginTop>0.25in</MarginTop> <MarginLeft>0.25in</MarginLeft><MarginRight>0.25in</MarginRight><MarginBottom>0.25in</MarginBottom></DeviceInfo>"
      Dim warnings As Warning()
      m_streams = New List(Of Stream)()
      Dim pageStream As Stream

      Dim firstPageParameters As NameValueCollection = New NameValueCollection()
      firstPageParameters.Add("rs:PersistStreams", "True")
      firstPageParameters.Add("rs:Command", "ClearSession")
      Dim nonFirstPageParameters As NameValueCollection = New NameValueCollection()
      nonFirstPageParameters.Add("rs:GetNextStream", "True")


      pageStream = report.Render("IMAGE", deviceInfo, firstPageParameters, "image/jpeg", ".jpeg")

      While pageStream.Length > 0
        m_streams.Add(pageStream)
        pageStream = report.Render("IMAGE", deviceInfo, nonFirstPageParameters, "image/jpeg", ".jpeg")
      End While



    Catch ex As Exception
      Master.AlertMessageBox(ex.Message)
    End Try
  End Sub

I get error in pageStream = report.Render("IMAGE", deviceInfo, firstPageParameters, "image/jpeg", ".jpeg")

where it is unable to recognize paraemeter passed

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,951 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,756 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xingyu Zhao-MSFT 5,366 Reputation points
    2021-01-27T06:10:29.903+00:00

    Hi @krishna ,
    You can try to call SetExecutionParameters method before you call report.Render().
    Also have a look at the following references:

    1. How To: Execute and Save SSRS Report using C#
    2. Call SSRS Reports by using C#

    You can convert the C# code to VB .NET.
    Hope them could be helpful.

    Best Regards,
    Xingyu Zhao
    *
    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.