make sure of the names of your parameters. like par1 is not Par1. you are pulling blank values. try that. otherwise if you are only calling two values from this entire form, just call those two fields directly. uses less coding and no loops. Plus, less room for error!
SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68
I am confused by your code.. but let's see.
You set par() equal to the total parameters, so if you have 3 parameters, it will be par(3). Are you trying to make this into an array for reading it later? Cause you are never adding the values to the array.
Try using this to add the values to the array:
ReportViewer1.ProcessingMode = ProcessingMode.Local
Dim rep As LocalReport = ReportViewer1.LocalReport
rep.ReportPath = "RptProductPhoto.rdlc"
Dim I As Byte
Dim GetParameter As String = ""
Dim TotalParameter As Byte
TotalParameter = rep.GetParameters.Count
Dim par(TotalParameter - 1) As Microsoft.Reporting.WebForms.ReportParameter
For I = 0 To rep.GetParameters.Count - 1
GetParameter = rep.GetParameters.Item(I).Name
Select Case LCase(GetParameter)
Case "par1"
par(I) = New Microsoft.Reporting.WebForms.ReportParameter(GetParameter, "Par1")
Case "par2"
par(I) = New Microsoft.Reporting.WebForms.ReportParameter(GetParameter, "Par2")
End Select
rep.SetParameters(par(I))
Next
This adds the certain parameter to your array of par. I was confused why you had it after the Next command and just (par) and not with a value.. so it makes sense now. Since you never added anything to "par", it returned null. Try that.
SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68
here, to find out what it is spitting out, try debugging the lines that are "null". If you can, make the string write out the par lines and see what it is displaying. Let me know.
SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68
Two things.. maybe on your first code it requires you to specifiy the visibibility, so replace these lines:
(GetParameter, "Par1", false/true)
(GetParameter, "Par2", false/true)
and make the false/true set to your visibility, false none, true visible.
The other, try this:
ReportViewer1.ProcessingMode = ProcessingMode.Local
Dim rep As LocalReport = ReportViewer1.LocalReport
rep.ReportPath = "RptProductPhoto.rdlc"
Dim I As Byte
Dim GetParameter As String = ""
Dim TotalParameter As Byte
TotalParameter = rep.GetParameters.Count
Dim paramlist As New Generic.List(Of ReportParameter)
For I = 0 To rep.GetParameters.Count - 1
GetParameter = rep.GetParameters.Item(I).Name
Select Case LCase(GetParameter)
Case "par1"
par.Add(New ReportParameter(GetParameter, "Par1"))
Case "par2"
par.Add(New ReportParameter(GetParameter, "Par2"))
End Select
Next
rep.SetParameters(par)
SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68