首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

紧急SelectCommand.Connection 属性尚未初始化

2012-02-23 
紧急求救,十万火急。。。SelectCommand.Connection 属性尚未初始化我的网站程序在2005下测试运行一切正常为什

紧急求救,十万火急。。。SelectCommand.Connection 属性尚未初始化
我的网站程序在2005下测试运行一切正常为什么发布后运行首页会出现这种情况。
“/WebAttendence”应用程序中的服务器错误。
--------------------------------------------

Fill:   SelectCommand.Connection   属性尚未初始化。  
说明:   执行当前   Web   请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。  

异常详细信息:   System.InvalidOperationException:   Fill:   SelectCommand.Connection   属性尚未初始化。

源错误:  


行   221:custDA.SelectCommand   =   cmd;
行   222:DataTable   dt   =   new   DataTable( "DataList ");
行   223:custDA.Fill(dt);
行   224:
行   225:cmd.Parameters.Clear();
 

源文件:   D:\ninetowns\东莞指纹考勤\源代码\WorkAttendance\Ninetowns.WorkAttendance.OracleDAL\OraHelper.cs         行:   223  

堆栈跟踪:  


[InvalidOperationException:   Fill:   SelectCommand.Connection   属性尚未初始化。]
      System.Data.Common.DbDataAdapter.GetConnection3(DbDataAdapter   adapter,   IDbCommand   command,   String   method)   +1381395
      System.Data.Common.DbDataAdapter.FillInternal(DataSet   dataset,   DataTable[]   datatables,   Int32   startRecord,   Int32   maxRecords,   String   srcTable,   IDbCommand   command,   CommandBehavior   behavior)   +73
      System.Data.Common.DbDataAdapter.Fill(DataTable[]   dataTables,   Int32   startRecord,   Int32   maxRecords,   IDbCommand   command,   CommandBehavior   behavior)   +162
      System.Data.Common.DbDataAdapter.Fill(DataTable   dataTable)   +107
      Ninetowns.WorkAttendance.OracleDAL.OraHelper.GetDataTable(String   connString,   CommandType   cmdType,   String   cmdText,   OracleParameter[]   cmdParms)   in   D:\ninetowns\东莞指纹考勤\源代码\WorkAttendance\Ninetowns.WorkAttendance.OracleDAL\OraHelper.cs:223
      Ninetowns.WorkAttendance.OracleDAL.BaseT_EMPLOYEEDAL.GetAllSonT_EMPLOYEEs()   in   D:\ninetowns\东莞指纹考勤\源代码\WorkAttendance\Ninetowns.WorkAttendance.OracleDAL\BaseOracleDAL\BaseT_EMPLOYEEDAL.cs:177
      Ninetowns.WorkAttendance.Business.BaseT_EMPLOYEEBusiness.GetAllSonT_EMPLOYEEs()   in   D:\ninetowns\东莞指纹考勤\源代码\WorkAttendance\Ninetowns.WorkAttendance.Business\BaseBusiness\BaseT_EMPLOYEEBusiness.cs:49
      login.Page_Load(Object   sender,   EventArgs   e)   +18
      System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr   fp,   Object   o,   Object   t,   EventArgs   e)   +15
      System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object   sender,   EventArgs   e)   +43
      System.Web.UI.Control.OnLoad(EventArgs   e)   +98
      System.Web.UI.Control.LoadRecursive()   +71
      System.Web.UI.Page.ProcessRequestMain(Boolean   includeStagesBeforeAsyncPoint,   Boolean   includeStagesAfterAsyncPoint)   +4313

 


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

[解决办法]
行 221:custDA.SelectCommand = cmd;
行 222:DataTable dt = new DataTable( "DataList ");
行 223:custDA.Fill(dt);


行 224:
行 225:cmd.Parameters.Clear();

把数据连接打开
conn.open
[解决办法]
调试一下custDA内部,看看在custDA.Fill(dt)之前是不是没有open()还是close()了?
[解决办法]
连接问题!!仔细看看!
[解决办法]
dim conn as new sqlconnetion(STRing)
你一定是少了
custDA.connction=conn
[解决办法]
楼主肯定是不小心漏了一句


热点排行