我正在尝试修复一个由不再适用于我们公司的人创建的项目。任何人都可以帮我弄清楚为什么我会得到这个
发生了LocalProcessingException
错误?以下是我的代码。它在Response.Buffer = True
死亡。我的所有参数都包含数据。但似乎其中一个报告生成变量中没有数据。我假设其中一个
warnings
streamids
mimeType
encoding
format
extension
devInfo
任何帮助都会很棒。我在这个网站上尝试了很多其他建议,但无济于事。正如我所说,这是我第一个进入的代码。堆栈跟踪结束。
//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
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`
答案 0 :(得分:0)
因此,这是一个相对较古老的帖子,但在与Google相关的我搜索中弹出。是您的Render方法中“ deviceInfo”上的错字吗?
deviceInfo = "<DeviceInfo><OutputFormat>PDF</OutputFormat></DeviceInfo>"
Try
bytes = lr.Render(format, *devInfo*, extension, encoding, mimeType, streamids, warnings)
应该是:
deviceInfo = "<DeviceInfo><OutputFormat>PDF</OutputFormat></DeviceInfo>"
Try
bytes = lr.Render(format, *deviceInfo*, extension, encoding, mimeType, streamids, warnings)