我估计是个小问题可是老找不到原因Server Error in '/hycom' Application.
--------------------------------------------------------------------------------Cannot find table 0. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IndexOutOfRangeException: Cannot find table 0.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  Stack Trace: 
[IndexOutOfRangeException: Cannot find table 0.]
   System.Data.DataTableCollection.get_Item(Int32 index) +79
   hyclerk.BF_clerk.GetHotelName()
   Hycom.login.Page_Load(Object sender, EventArgs e)
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +731 
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573 上面就是网站打不开显示的内容,我在2003上面装的时候也出现过,改了一下权限就OK了,可是现在在XP上面装的时候出现这个问题改权限也不行还是这个问题,怎么解决啊,我现在就需要在XP上装看问题出在那里?希望高手指点,别说不行你还装2003吧O(∩_∩)O!先谢谢了!!!

解决方案 »

  1.   

    IndexOutOfRangeException: Cannot find table 0
    溢出。。  找不到table 0
      

  2.   

    Hycom.login.Page_Load(Object sender, EventArgs e)错误发生在login页面的Page_Load方法中。hyclerk.BF_clerk.GetHotelName()

    这个GetHotelName()的方法抛出异常Cannot find table 0
    这个异常也很明显,是这个方法从数据库没有查到任何数据,然后,你在程序中,又使用了类似ds.Tables[0]的语句,导致抛出了IndexOutOfRangeException,索引越界的异常。
      

  3.   

    两个问题:
    第一,要不就是查询语句有问题,要不就是数据库连接字符串配置不正确,反正是没有返回结果。第二,程序写法有问题,要写一个健壮的程序,在拿到DataSet数据集之后,必然要先进行一个非空的判断,才能使用它,例如:DataSet ds = .....;
    if(ds != null && ds.Tables.Count > 0)
    {
        // 这个地方你才能操作ds.Tables[0]
        if(ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
        {
            // 这个地方,你才可以使用foreach(DataRow row in ds.Tables[0].Rows),便利二维表格
        }
    }