未处理的是如何修复的bug本地处理异常传递参数时,报告RDLC的winform? [英] How to Fix the bug Local processing Exception was unhandled when passing parameter to report rdlc winform?

查看:542
本文介绍了未处理的是如何修复的bug本地处理异常传递参数时,报告RDLC的winform?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做的学院项目。在此,他们希望一位诚实的证书。对于这一点,我打算通过文本框字符串汇报。



我GOOGLE传递参数的一个WinForm。然后,我得到这个循序渐进的过程。我实施




步骤:



1:在Visual Studio 2010中,打开你的
.rdlc文件,并打开报告数据
窗口(如果你不能看到这个
窗口,打开视图菜单打开它);



2:右键单击参数节点,
和添加新的参数,即:将其命名为
内容;



3:在您的.rdlc文件,添加一个文本框,
将其命名为tbContent,并设置其申请
快递至:



=参数content.Value



4:转到您的表单文件,其中包括
你reporterview控制,并添加
以下代码:

  this.reportViewer1.LocalReport.ReportEmbeddedResource 

=TestReport.Report1.rdlc;
ReportParameter RP =新ReportParameter(内容,
this.textBox1.Text);
this.reportViewer1.LocalReport.SetParameters(新
ReportParameter [] {RP});
this.reportViewer1.RefreshReport();



5:然后你可以从文本框传递参数
表格上.rdlc
档;




我添加使用Microsoft.Reporting.WinForms; 组装参考。

  this.reportViewer1.LocalReport.ReportEmbeddedResource =Report1.rdlc; 

ReportParameter RP =新ReportParameter(内容,this.textBox1.Text);
this.reportViewer1.LocalReport.SetParameters(新ReportParameter [] {RP});
this.reportViewer1.RefreshReport();



但它引发异常:




本地处理的例外是在结果
this.reportViewer1.LocalReport.SetParameters
未处理(新
ReportParameter [] {RP});
线




下面是从剪贴板完整的错误:

  Microsoft.Reporting.WinForms.LocalProcessingException了未处理
消息=本地报表处理过程中出错。
来源= Microsoft.ReportViewer.WinForms
堆栈跟踪:在Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()
在Microsoft.Reporting.WinForms.LocalReport.SetParameters(IEnumerable`
1参数)在Report.Form1.Form1_Load
(对象发件人,EventArgs e)在D:\Jagadeeswaran\Project\Report\Report\Form1.cs:38行
的系统。 Windows.Forms.Form.OnLoad(EventArgs五)
在System.Windows.Forms.Form.OnCreateControl()
在System.Windows.Forms.Control.CreateControl(布尔fIgnoreVisible)
。在System.Windows.Forms.Control.CreateControl()
在System.Windows.Forms.Control.WmShowWindow(消息和M)
在System.Windows.Forms.Control.WndProc(消息和M)
。在System.Windows.Forms.ScrollableControl.WndProc(消息和M)
在System.Windows.Forms.Form.WmShowWindow(消息和M)
在System.Windows.Forms.Form中。的WndProc(消息和M)
在System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息和;米)
在System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息和M)
在System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr的的HWND,味精的Int32,IntPtr的WPARAM,LPARAM的IntPtr)
在System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef的hWnd,的Int32的nCmdShow)
在System.Windows.Forms.Control.SetVisibleCore(布尔值)System.Windows.Forms的
。 Form.SetVisibleCore(布尔值)
在System.Windows.Forms.Control.set_Visible(布尔值)
在System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(的Int32原因,ApplicationContext的情况下)
在System.Windows.Forms.Application.ThreadContext.RunMessageLoop(的Int32原因,ApplicationContext的情况下)
在System.Windows.Forms.Application.Run(表格的MainForm)
在Report.Program.Main( )在D:\Jagadeeswaran\Project\Report\Report\Program.cs:在System.AppDomain._nExecuteAssembly线18
(RuntimeAssembly组装,字串[] args)
的系统。 AppDomain.ExecuteAssembly(字符串assemblyFile,证据assemblySecurity,字串[] args)
在Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在System.Threading.ThreadHelper.ThreadStart_Context(对象状态)
。在System.Threading.ExecutionContext.Run(ExecutionContext中的ExecutionContext,ContextCallback回调,对象状态,布尔ignoreSyncCtx)
在System.Threading.ExecutionContext.Run(ExecutionContext中的ExecutionContext,ContextCallback回调,对象的状态)
。在系统.Threading.ThreadHelper.ThreadStart()
的InnerException:System.ApplicationException
消息=报表'D报表定义:\Jagadeeswaran\Project\Report\Report\bin\Debug\\ \\〜/ Report1.rdlc尚未指定
来源= Microsoft.ReportViewer.Common
堆栈跟踪:
在Microsoft.Reporting.PreviewStore.GetCompiledReport(CatalogItemContextBase背景下,布尔重建,字节] &安培; reportDefinition,ControlSnapshot&安培;快照)
在Microsoft.Reporting.LocalService.GetCompiledReport(CatalogItemContextBase itemContext布尔重建,ControlSnapshot&安培;快照)
在Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()
的InnerException:System.IO .DirectoryNotFoundException
消息=找不到路径D:\Jagadeeswaran\Project\Report\Report\bin\Debug\〜\Report1.rdlc的一部分。
来源= mscorlib程序
堆栈跟踪:在System.IO .__ Error.WinIOError(的Int32的errorCode,字符串maybeFullPath)
。在System.IO.FileStream.Init
(字符串路径,模式的FileMode ,FileAccess的访问,的Int32权利,布尔useRights,文件共享份额,缓冲区大小的Int32,FileOptions选项,SECURITY_ATTRIBUTES secAttrs,字符串MSGPATH,布尔bFromProxy,布尔useLongPath)在System.IO.FileStream..ctor
(字符串路径,模式的FileMode在Microsoft.Reporting.PreviewStore.GetCompiledReport,FileAccess的访问,文件共享份额)
在Microsoft.ReportingServices.StandalonePreviewStore.GetReportDefinition(ReportID reportId)
(CatalogItemContextBase背景下,布尔重建,字节[]放大器; reportDefinition,ControlSnapshot和放大器;快照)
的InnerException:


解决方案

设置此

  this.reportViewer1.ProcessingMode = 
Microsoft.Reporting.WinForms.ProcessingMode.Local;

和改变这样的:

  this.reportViewer1.LocalReport.ReportEmbeddedResource =Report1.rdlc

  this.reportViewer1.LocalReport.ReportPath =Report1.rdlc; 


I am doing college project. In that, they want a bonafide certificate. For that, I planned to pass TextBox string to report.

I googled for passing parameter in a winform. Then I got this step by step process. I implement that.

Step:

1: In Visual Studio 2010, open your .rdlc file, and open "Report Data" window (If you can not see this window, go to View menu to open it);

2: Right click the "Parameters" node, and add a new Parameter, ie: named it "content";

3: In your .rdlc file, add a textbox, named it tbContent, and set its filed express to :

=Parameters!content.Value

4: Go to your Form file which include your reporterview control, and add the following code:

       this.reportViewer1.LocalReport.ReportEmbeddedResource

= "TestReport.Report1.rdlc"; ReportParameter rp = new ReportParameter("content", this.textBox1.Text); this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp }); this.reportViewer1.RefreshReport();

5: then you can pass the parameter from the TextBox on the form to .rdlc file;

I added using Microsoft.Reporting.WinForms; assembly reference.

 this.reportViewer1.LocalReport.ReportEmbeddedResource = "Report1.rdlc";

            ReportParameter rp = new ReportParameter("content", this.textBox1.Text);
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
            this.reportViewer1.RefreshReport();  

But it throws the exception:

Local processing Exception was unhandled at
this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp }); line.

Here's the full error from the clipboard:

  Microsoft.Reporting.WinForms.LocalProcessingException was unhandled
  Message=An error occurred during local report processing.
  Source=Microsoft.ReportViewer.WinForms
  StackTrace:
       at Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()
       at Microsoft.Reporting.WinForms.LocalReport.SetParameters(IEnumerable`1 parameters)
       at Report.Form1.Form1_Load(Object sender, EventArgs e) in D:\Jagadeeswaran\Project\Report\Report\Form1.cs:line 38
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
       at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.set_Visible(Boolean value)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at Report.Program.Main() in D:\Jagadeeswaran\Project\Report\Report\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.ApplicationException
       Message=The report definition for report 'D:\Jagadeeswaran\Project\Report\Report\bin\Debug\~/Report1.rdlc' has not been specified
       Source=Microsoft.ReportViewer.Common
       StackTrace:
            at Microsoft.Reporting.PreviewStore.GetCompiledReport(CatalogItemContextBase context, Boolean rebuild, Byte[]& reportDefinition, ControlSnapshot& snapshot)
            at Microsoft.Reporting.LocalService.GetCompiledReport(CatalogItemContextBase itemContext, Boolean rebuild, ControlSnapshot& snapshot)
            at Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()
       InnerException: System.IO.DirectoryNotFoundException
            Message=Could not find a part of the path 'D:\Jagadeeswaran\Project\Report\Report\bin\Debug\~\Report1.rdlc'.
            Source=mscorlib
            StackTrace:
                 at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
                 at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
                 at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
                 at Microsoft.ReportingServices.StandalonePreviewStore.GetReportDefinition(ReportID reportId)
                 at Microsoft.Reporting.PreviewStore.GetCompiledReport(CatalogItemContextBase context, Boolean rebuild, Byte[]& reportDefinition, ControlSnapshot& snapshot)
            InnerException: 

解决方案

Set this:

this.reportViewer1.ProcessingMode = 
    Microsoft.Reporting.WinForms.ProcessingMode.Local;

And change this:

this.reportViewer1.LocalReport.ReportEmbeddedResource = "Report1.rdlc" 

to

this.reportViewer1.LocalReport.ReportPath = "Report1.rdlc";

这篇关于未处理的是如何修复的bug本地处理异常传递参数时,报告RDLC的winform?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆