日期:2014-05-18  浏览次数:20996 次

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

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

源错误:  


行   195:                 {
行   196:                        
行   197:                         Database   db   =   DatabaseFactory.CreateDatabase();
行   198:                        
行   199:                         DbCommand   cmd   =   db.GetStoredProcCommand( "SearchKyxmByMc ");
 

源文件:   F:\science\DataBusiness\Kyxm.cs         行:   197  

堆栈跟踪:  


[NullReferenceException:   未将对象引用设置到对象的实例。]
      Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConfigurationView.get_DefaultName()   +45
      Microsoft.Practices.EnterpriseLibrary.Data.DatabaseMapper.MapName(String   name,   IConfigurationSource   configSource)   +79
      Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfigurationNameMappingStrategy.BuildUp(IBuilderContext   context,   Type   t,   Object   existing,   String   id)   +160
      Microsoft.Practices.ObjectBuilder.BuilderBase`1.DoBuildUp(IReadWriteLocator   locator,   Type   typeToBuild,   String   idToBuild,   Object   existing,   PolicyList[]   transientPolicies)   +339
      Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp(IReadWriteLocator   locator,   Type   typeToBuild,   String   idToBuild,   Object   existing,   PolicyList[]   transientPolicies)   +194
      Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp(IReadWriteLocator   locator,   String   idToBuild,   Object   existing,   PolicyList[]   transientPolicies)   +111
      Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp(IReadWriteLocator   locator,   IConfigurationSource   configurationSource)   +255
      Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp(IConfigurationSource   configurationSource)   +72
      Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.NameTypeFactoryBase`1.CreateDefault()   +79
      Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase()   +88
      DataBusiness.Kyxm.Search_mc(String   kyxmmc)   in   F:\science\DataBusiness\Kyxm.cs:197
      control_Search.Button1_Click(Object   sender,   EventArgs   e)   in   f:\science\scienceWeb\control\Search.ascx.cs:141
      System.Web.UI.WebControls.Button.OnClick(EventArgs   e)   +75
      System.Web.UI.WebControls.Button.RaisePostBackEvent(String   eventArgument)   +97
      System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEv