I need to take an existing SQL (SSRS) report and use VB.NET code to save the report to a PDF.
I have created a table of records and each record has a report type. No problem if I want to produce a single one and displayed. What I want to do is have a loop that goes through the table, selects record/type and produce a PDF and puts in a certain folder area.
No problem getting record from table and displaying it but I want to save as a pdf in a certain folder location for each of the records.
It is the PDF creation of the report that I have been having problems
Any help in the right direction would be great.
Below, displays fine but I want to create a PDF.
What I have tried:
Dim ParamData As New Dictionary(Of String, String)
ParamData.Add("IDNumber", 1234)
ShowForm("ReportName", ParamData, 1, "LocationOfReports")
Public Sub ShowForm(ByVal strReportName As String, ByVal ParamData As Dictionary(Of String, String), ByVal intParamCount As Integer, Optional ByVal strReportPath As String = "ATest")
Me.Show()
Me.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote
Me.ReportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = System.Net.CredentialCache.DefaultCredentials
Me.ReportViewer1.ServerReport.ReportServerUrl = New Uri("http://ReportServer_Test")
Me.ReportViewer1.ServerReport.ReportPath = "/" & strReportPath & "/" & strReportName '"ATester"
Me.ReportViewer1.Dock = DockStyle.Fill
Me.Controls.Add(Me.ReportViewer1)
If intParamCount > 0 Then
Dim params(intParamCount - 1) As Microsoft.Reporting.WinForms.ReportParameter
If ParamData.Keys.Count > 0 Then
Dim intParamKey As Integer = 0
For Each elemItem In ParamData
params(intParamKey) = New Microsoft.Reporting.WinForms.ReportParameter(elemItem.Key, elemItem.Value)
intParamKey = intParamKey + 1
Next
End If
ReportViewer1.ServerReport.SetParameters(params)
End If
Me.ReportViewer1.RefreshReport()
End Sub