Quantcast
Channel: SQL Server Reporting Services
Viewing all articles
Browse latest Browse all 1418

Report Viewer which generate and send PDF file can't work on the server

$
0
0

Hi,

I am having problem when running an EXE file created by VS2010 on the Server thru SQL Server Agent (Batch).

It working well when running on the local PC / Laptop.

Please help me to solve the problem below. See the Source Code below.

Thanks & Regards,

Syarif

 

Dim rds As New ReportDataSource

rds.Name = "rdsForReportViewer"

Dim DriverNameParm As String

Dim RegisterNumParm As String

Dim OpenReadingParm As String

rds.Value = DSViewer1.GetData(RegisterNumParm, DriverNameParm)

rds.DataSourceId = "rdsForReportViewer"

Dim warnings As Warning() = Nothing

Dim streamids As String() = Nothing

Dim mimeType As String = Nothing

Dim encoding As String = Nothing

Dim extension As String = Nothing

Dim deviceInfo As String = Nothing

Dim viewer As New ReportViewer()

viewer.Reset()

viewer.LocalReport.Dispose()

viewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local

viewer.LocalReport.ReportPath = "Net40_OdometerReadingForm.rdlc"

viewer.LocalReport.DataSources.Clear()

viewer.LocalReport.DataSources.Add(rds)

viewer.LocalReport.Refresh()

Dim myparams As New List(Of ReportParameter)

myparams.Add(New ReportParameter("DriverName", DriverNameParm))

myparams.Add(New ReportParameter("RegisterNum", RegisterNumParm))

myparams.Add(New ReportParameter("OpenReading", OpenReadingParm))

viewer.LocalReport.SetParameters(myparams)

Dim bytes As Byte()

Try  

     bytes = viewer.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)

Catch ex As Exception   

     ErrorEmail(ReportEmailAddress, ex.Message)   SQLConn.Close()

Exit Sub

End Try

 

                       

              

 


Viewing all articles
Browse latest Browse all 1418

Trending Articles