日期:2014-05-19  浏览次数:20342 次

System.NullReferenceException: 未将对象引用设置到对象的实例
“/”应用程序中的服务器错误。
--------------------------------------------

未将对象引用设置到对象的实例。  
说明:   执行当前   Web   请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。  

异常详细信息:   System.NullReferenceException:   未将对象引用设置到对象的实例。

源错误:  

执行当前   Web   请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。    

堆栈跟踪:  


[NullReferenceException:   未将对象引用设置到对象的实例。]
      order_err.Button1_Click(Object   sender,   EventArgs   e)   +105
      System.Web.UI.WebControls.Button.OnClick(EventArgs   e)   +105
      System.Web.UI.WebControls.Button.RaisePostBackEvent(String   eventArgument)   +107
      System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String   eventArgument)   +7
      System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler   sourceControl,   String   eventArgument)   +11
      System.Web.UI.Page.RaisePostBackEvent(NameValueCollection   postData)   +33
      System.Web.UI.Page.ProcessRequestMain(Boolean   includeStagesBeforeAsyncPoint,   Boolean   includeStagesAfterAsyncPoint)   +5102

 


--------------------------------------------
版本信息:   Microsoft   .NET   Framework   版本:2.0.50727.42;   ASP.NET   版本:2.0.50727.210  




------解决方案--------------------
在使用对象的成员的时候有没有判断这个对象是null值,
你看是不是类似如下的方法有问题:

object[string].Method()

比如object[string]是空上面的就会出错了.