报表处理期间发生错误.调用的目标抛出了异常.对象引用未设置为对象的实例 [英] An error has occured during report processing.Exception has been thrown by the target of an invocation.Object reference not set to an instance of an object

查看:111
本文介绍了报表处理期间发生错误.调用的目标抛出了异常.对象引用未设置为对象的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<pre lang="cs">public void ShowQueryBranchTATCrossed()
      {
          bool vFlag = false;

          try
          {
              rptViewer.Visible = true;
              //rptViewer.LocalReport.ReportPath="C:/Priya Working Folder/WorkingEnvironment/ILeverage2k10/ILeverage2k10/ILev_QueryBranchTATCrossedReport.rdlc";
              rptViewer.LocalReport.Refresh();

              vFlag = true;

          }
          catch (Exception Exp)
          {
              LogEvent(Exp);
              vFlag = false;
          }


          if (!vFlag)
          {
              ScriptManager.RegisterClientScriptBlock(this, typeof(string), "message", "alert(''Unable to retrive the data, please contact system admin.'');location.href=''ILeverage_Blank.aspx''", true);
          }
      }


推荐答案

在哪里?哪条线?
尝试并调试此代码.
当尚未实例化某些对象且该对象为null且我们试图访问其中的属性或方法时,会发生此错误.找出哪个对象为空,然后对其进行初始化.

可能是rptViewer.LocalReport.Refresh(); where you are trying to access Refresh(),但LocalRepost可能是null.
Where? Which line?
Try and debug this code.
This error occurs when some object has not been instantiated and is null and we are trying to access an attribute or method inside it. Figure out which object is null and then initialize it.

It could be rptViewer.LocalReport.Refresh(); where you are trying to access Refresh() but LocalRepost may be null.


这篇关于报表处理期间发生错误.调用的目标抛出了异常.对象引用未设置为对象的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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