scottrgeorge
New member
- Joined
- Feb 8, 2016
- Messages
- 2
- Programming Experience
- Beginner
I am very new to coding and have a project I am trying to fix that was created by a person that no longer works with our company. Can anyone help me figure out why I am getting this LocalProcessingException Occurred error? Below is my code. It dies on Response.Buffer = True. All of my parameters have data in them. But it seems as though one of the report generation variables doesn't have data in them. I am assuming its one of these - format, devInfo, extension, encoding, mimeType, streamids, warnings. Any help would be great. I have tried a lot of the other suggestions on this site but to no avail. And as I said this is really the first code I've gotten into.
The stack trace is > at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings) at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings) at Microsoft.Reporting.WebForms.LocalReport.Render(String format, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings) at Microsoft.Reporting.WebForms.Report.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings) at ChargingRequest._Default.btnPrint_Click(Object sender, EventArgs e) in H:\Visual Studio 2010\ChargingRequest\ChargingRequest\ChargeReq.aspx.vb:line 301.
Line 301 in my aspx.vb file is Response.Buffer = True
' report generation variables
Dim warnings As Warning() = Nothing
Dim streamids As String() = Nothing
Dim mimeType As String = ""
Dim encoding As String = ""
Dim format As String = "PDF"
Dim extension As String = ""
Dim devInfo As String = "<DeviceInfo><Toolbar>True</Toolbar></DeviceInfo>"
Dim bytes As Byte() = Nothing
Dim lr As New LocalReport
Dim leadsTable As DataTable = retrievePersons(caseNum.Text)
Dim supplTable As DataTable = CType(Session("personTable"), DataTable)
Dim personTable As DataTable = combinePersons(leadsTable, supplTable)
' if there is data ...
If personTable.Rows.Count > 0 Then
' assume the best ....
ctlNotice.Visible = False
ctlNotice.Text = ""
' retrieve the charges
'Dim chargesTable As DataTable = retrieveCharges(caseNum.Text)
Dim chargesTable As DataTable = CType(Session("chargeTable"), DataTable)
Dim employeeTable As DataTable = retrieveEmployee()
Session("employeeTable") = employeeTable
' make sure there were charges added
If chargesTable.Rows.Count = 0 Then
ctlNotice.Visible = True
ctlNotice.Text = "There are no charges. Please add them first."
Else
lr.ReportEmbeddedResource = "CRForm.rdlc"
lr.DataSources.Add(New ReportDataSource("ACRDataSet_DataTable1", personTable))
' charges for the charge subreport
lr.DataSources.Add(New ReportDataSource("Charges02_ChargesTable", chargesTable))
' employee specific information
lr.DataSources.Add(New ReportDataSource("Employee2", employeeTable))
' add the datasource update to the subreport
AddHandler lr.SubreportProcessing, AddressOf SubreportProcessingEventHandler
lr.SetParameters(myParam)
'deviceInfo = "<DeviceInfo><OutputFormat>PDF</OutputFormat></DeviceInfo>"
Try
bytes = lr.Render(format, devInfo, extension, encoding, mimeType, streamids, warnings)
Response.Buffer = True
Response.Clear()
Response.ContentType = mimeType
Response.AddHeader("content-disposition", "attachment; filename=ChargingRequest_" + cleanCaseNum(caseNum.Text) + ".pdf")
Response.BinaryWrite(bytes)
Response.Flush()
Session("localReport") = bytes
Catch exn As Exception
ctlNotice.Text = "Call Support!. Can't create the report! " & exn.Message
ctlNotice.Visible = True
End Try
The stack trace is > at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings) at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings) at Microsoft.Reporting.WebForms.LocalReport.Render(String format, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings) at Microsoft.Reporting.WebForms.Report.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings) at ChargingRequest._Default.btnPrint_Click(Object sender, EventArgs e) in H:\Visual Studio 2010\ChargingRequest\ChargingRequest\ChargeReq.aspx.vb:line 301.
Line 301 in my aspx.vb file is Response.Buffer = True
' report generation variables
Dim warnings As Warning() = Nothing
Dim streamids As String() = Nothing
Dim mimeType As String = ""
Dim encoding As String = ""
Dim format As String = "PDF"
Dim extension As String = ""
Dim devInfo As String = "<DeviceInfo><Toolbar>True</Toolbar></DeviceInfo>"
Dim bytes As Byte() = Nothing
Dim lr As New LocalReport
Dim leadsTable As DataTable = retrievePersons(caseNum.Text)
Dim supplTable As DataTable = CType(Session("personTable"), DataTable)
Dim personTable As DataTable = combinePersons(leadsTable, supplTable)
' if there is data ...
If personTable.Rows.Count > 0 Then
' assume the best ....
ctlNotice.Visible = False
ctlNotice.Text = ""
' retrieve the charges
'Dim chargesTable As DataTable = retrieveCharges(caseNum.Text)
Dim chargesTable As DataTable = CType(Session("chargeTable"), DataTable)
Dim employeeTable As DataTable = retrieveEmployee()
Session("employeeTable") = employeeTable
' make sure there were charges added
If chargesTable.Rows.Count = 0 Then
ctlNotice.Visible = True
ctlNotice.Text = "There are no charges. Please add them first."
Else
lr.ReportEmbeddedResource = "CRForm.rdlc"
lr.DataSources.Add(New ReportDataSource("ACRDataSet_DataTable1", personTable))
' charges for the charge subreport
lr.DataSources.Add(New ReportDataSource("Charges02_ChargesTable", chargesTable))
' employee specific information
lr.DataSources.Add(New ReportDataSource("Employee2", employeeTable))
' add the datasource update to the subreport
AddHandler lr.SubreportProcessing, AddressOf SubreportProcessingEventHandler
lr.SetParameters(myParam)
'deviceInfo = "<DeviceInfo><OutputFormat>PDF</OutputFormat></DeviceInfo>"
Try
bytes = lr.Render(format, devInfo, extension, encoding, mimeType, streamids, warnings)
Response.Buffer = True
Response.Clear()
Response.ContentType = mimeType
Response.AddHeader("content-disposition", "attachment; filename=ChargingRequest_" + cleanCaseNum(caseNum.Text) + ".pdf")
Response.BinaryWrite(bytes)
Response.Flush()
Session("localReport") = bytes
Catch exn As Exception
ctlNotice.Text = "Call Support!. Can't create the report! " & exn.Message
ctlNotice.Visible = True
End Try