question

Cholotron-7052 avatar image
0 Votes"
Cholotron-7052 asked Joyzhao-MSFT commented

rdlc passing multiple parameters

Hello, I am trying to pass multiple parameters to rdlc report
I get an error : Value cannot be null. Parameter name: reportParameters

Here is my code

     Private Sub fr_manprint_Load(sender As Object, e As EventArgs) Handles MyBase.Load
         Dim the_id(14) As String
         load_ids()
    
         Dim parameters(2) As Microsoft.Reporting.WinForms.ReportParameter
    
         Me.Icon = My.Resources.icon_print
         Me.tc_manprintTableAdapter.Fill(Me.ds_man.tc_manprint)
    
         parameters(1) = New Microsoft.Reporting.WinForms.ReportParameter("par01", the_id(1))
         parameters(2) = New Microsoft.Reporting.WinForms.ReportParameter("par02", the_id(2))
         Me.ReportViewer1.LocalReport.SetParameters(parameters)
         Me.ReportViewer1.RefreshReport()
     End Sub
sql-server-reporting-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Cholotron-7052 avatar image
0 Votes"
Cholotron-7052 answered Joyzhao-MSFT commented

this works

 Dim the_id(14) As String
 Private Sub fr_manprint_Load(sender As Object, e As EventArgs) Handles MyBase.Load
     Me.Icon = My.Resources.icon_print
 End Sub
 Private Sub fr_manprint_Shown(sender As Object, e As EventArgs) Handles Me.Shown
     Dim parameters(2) As Microsoft.Reporting.WinForms.ReportParameter

     load_ids()
     Me.tc_manprintTableAdapter.Fill(Me.ds_man.tc_manprint)
     parameters(0) = New Microsoft.Reporting.WinForms.ReportParameter("par01", the_id(1))
     parameters(1) = New Microsoft.Reporting.WinForms.ReportParameter("par02", the_id(2))
     parameters(2) = New Microsoft.Reporting.WinForms.ReportParameter("par03", the_id(3))
     Me.ReportViewer1.LocalReport.SetParameters(parameters)
     Me.ReportViewer1.RefreshReport()
 End Sub
 Private Sub load_ids()
     Dim the_st As Date = Nothing
     Dim format As String = "MM/dd"
     Try
         Cursor.Current = Cursors.WaitCursor
         app_cmd.CommandText = "select day_pos,day_date from tc_days where week_id=" & week_id & " order by day_id;"
         app_dr = app_cmd.ExecuteReader()
         While app_dr.Read()
             the_st = app_dr(1)
             the_id(app_dr(0)) = the_st.ToString(format)
         End While
         app_dr.Close()
     Catch ex As Exception
         MsgBox("load_ids: " & Err.Description, MsgBoxStyle.Critical, app_cia)
     Finally
         Cursor.Current = Cursors.Default
     End Try
 End Sub
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

That sounds like good news.
If you have any questions,please feel free to let me know.

0 Votes 0 ·

You could mark your answer as "Accept Answer" so that more people can see it.

0 Votes 0 ·