I am a tad confused with an exception that I get whet trying to render
a report to pdf. I pass 2 arraylists which contains the name and value
of the parameters. I iterate through these lists (which are of equal
lenght) and set the parameters. I am very new to this so I am sure that
I am doing something stupid somewhere in the code below:
' Create instance of save dialog and set default
' filename and filter
saveReportDialog = New SaveFileDialog
saveReportDialog.Filter = GetFilterString(pFormat)
saveReportDialog.FileName = pName
' Open the save file dialog
Dim dr As DialogResult = saveReportDialog.ShowDialog()
If dr = DialogResult.OK Then
Dim fileName As String = saveReportDialog.FileName
Dim historyID As String = Nothing
Dim deviceInfo As String = Nothing
Dim showHide As String = Nothing
Dim param() As ParameterValue = New
ParameterValue(pParameterValuesArrayList.Count) {}
Dim credentials As DataSourceCredentials() = Nothing
Dim results() As [Byte]
Dim encoding As String
Dim mimeType As String
Dim warnings As Warning() = Nothing
Dim reportHistoryParameters As ParameterValue() = Nothing
Dim streamIDs As String() = Nothing
'Iterate through the array of parameters and set the report parameters
Dim i As Integer
For i = 0 To pParameterValuesArrayList.Count - 1
param(i) = New ParameterValue
param(i).Name = pParameterNamesArrayList(i)
param(i).Value = pParameterValuesArrayList(i)
Next
'Exectute the report and save it into a file.
Try
results = rs.Render(ReportItem.Path, pFormat, historyID, deviceInfo,
param, credentials, showHide, encoding, mimeType,
reportHistoryParameters, warnings, streamIDs)
Dim stream As FileStream = File.OpenWrite(fileName)
stream.Write(results, 0, results.Length)
stream.Close()
Catch exception As Exception
HandleException(exception)
End Try
End If
when trying to execute the red line of code, I get the following error which confuses:
an exception has occured: The value of parameter 'Parameters' is not valid.
I don't even have a parameter called 'Parameters' . When debugging, I
have determined that the arraylists contain the values they are
supposed to so now I am in need of expertise of all you smart people
here :)
Thanks
MichaelWhat is the error message? Does the report seem to execute just fine when running it through the SSRS\reports website?|||Hi there,
The error I get is in the code... the message reads:
an exception has occured: The value of parameter 'Parameters' is not valid.
The report never opens from whithin my application but does work from the development environment.
The confusing thing is that the only parameter I have is called
"@.MemberID" and not "Parameters", so I don't know what this error
message means. I you look at the code I posted above, the exception is
thrown when I ty to render the report.
Regards
|||Hi, I feel it is necessary to say that I solved my own problem.
It was a more fundamental mistake. I have not converted the parameters
to be strings and thereby it was in invalid. What I did to solve this
problem was:
Dim i As Integer
For i = 0 To pParameterValuesArrayList.Count - 1
parameters(i) = New ParameterValue
parameters(i).Name = CStr(pParameterNamesArrayList(i))
parameters(i).Value = CStr(pParameterValuesArrayList(i))
Next
This worked fine :)
No comments:
Post a Comment