在ASP.NET类(而不是.aspx)中呈现rdlc报告时出错
问题描述:
大家好,我想用class中的rdlc报告生成pdf。如何分配报告名称(.rdlc)和渲染时,错误
Hello every one, I want to generate pdf using rdlc report from class. How to assign report name (.rdlc) and while rendering, error
引用:
报告定义的来源尚未指定
the source of the report definition has not been specified
https://snag.gy/0WnIyA.jpg
请帮助我。
提前致谢
我的尝试:
https://snag.gy/0WnIyA.jpg
Please help me.
Thanks in advance
What I have tried:
Dim ReportViewer1 As Microsoft.Reporting.WebForms.ReportViewer = New Microsoft.Reporting.WebForms.ReportViewer()
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
ReportViewer1.ServerReport.ReportServerUrl = New Uri("http://localhost:56370/NVSehore29jun18/")
ReportViewer1.ServerReport.ReportPath = System.Web.Hosting.HostingEnvironment.MapPath("~/PartyFiles/General/ZSLedger001.rdlc")
Dim rds As New Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", dt)
ReportViewer1.LocalReport.DataSources.Add(rds)
ReportViewer1.LocalReport.Refresh()
bytes = ReportViewer1.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)
Dim fs As FileStream = New FileStream(FilePath, FileMode.Open)
fs.Write(bytes, 0, bytes.Length)
fs.Close()
答
您应该验证RDL的路径(如果存在)。请将此讨论读作: c#4.0 - 来源尚未指定报告定义 - Stack Overflow [ ^ ]
PS:尝试调试代码,设置断点和进入你的代码,看看错误引发的位置。
You should verify the path to your RDL if it exist. Please give this discussion a read: c# 4.0 - The source of the report definition has not been specified - Stack Overflow[^]
PS: Try to debug your code, set a break point and step into your code to see figure out where the error is thrown.