“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------列“Id”不属于表 Table。  
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。  异常详细信息: System.ArgumentException: 列“Id”不属于表 Table。源错误:  执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。   堆栈跟踪:  
[ArgumentException: 列“Id”不属于表 Table。]
  System.Data.DataRow.GetDataColumn(String columnName) +1775301
  System.Data.DataRow.get_Item(String columnName) +13
  BLL.BLL_Program_Type.GetCatagoryList() in F:\潮声卫视\Solution1\BLL\BLL_Program_Type.cs:31
  Column_More.Page_Load(Object sender, EventArgs e) +85
  System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
  System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
  System.Web.UI.Control.OnLoad(EventArgs e) +99
  System.Web.UI.Control.LoadRecursive() +50
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627 
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.3603; ASP.NET 版本:2.0.50727.3614 
以下为出错代码源,我看不出来错在那里。public ArrayList GetCatagoryList()
        {
            ArrayList list1 = new ArrayList();
            DataSet ds = DAL.Program_Type.Get_Program_Type_List();
            MODEL.Program_type Program_type = new MODEL.Program_type();
            if (ds.Tables["Table"].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables["Table"].Rows.Count; i++)
                {
                    Program_type = new Program_type();
                    Program_type.Id = new Guid(ds.Tables["Table"].Rows[i]["Id"].ToString());
                    Program_type.Program_Typename =ds.Tables["Table"].Rows[i]["Program_Typename"].ToString();
                    list1.Add(Program_type);
                }
            }
            return list1;
        }

解决方案 »

  1.   

    ds.Tables["Table"]里没有"id"字段把. 你跟中下DS里的TABLE看看.
      

  2.   

    列“Id”不属于表 Table提示很清楚啊,你调试下咯。
      

  3.   

    DataSet ds = DAL.Program_Type.Get_Program_Type_List();
    Program_type.Id = new Guid(ds.Tables["Table"].Rows[i]["Id"].ToString());DAL读取的数据集中,表Table没有ID这个字段!
      

  4.   

    表Table没有Id这个字段,或者,sql查询的时候,没有返回这个列,你去查查数据结构,还有数据访问层,这两个地方
      

  5.   

    看看你的Model层,该类中的ID列的大小写是否为你所写的Id.
      

  6.   

    你的table里面有id这个字段吗?
      

  7.   

    先看看字段名是否相同,然后在看看你返回的的集合名是不是叫Table啊
      

  8.   

    以下是我的数据库连接代码,但是有时出现以下问题
    ExecuteReader 要求已打开且可用的连接。连接的当前状态为正在连接。 #region 打开连接
      public void Open()
      {
      Conn = new SqlConnection();
      Cmd = new SqlCommand();
      if ((this.Conn != null) && (this.Conn.State != ConnectionState.Open))
      {
      Conn.ConnectionString = ConfigurationManager.ConnectionStrings["ConnStr"].ToString();
      this.Conn.Open();
      }
        
      Cmd.Connection = Conn;
      }
      #endregion  #region 关闭连接
      public void Close()
      {
      if ((this.Conn != null) && (this.Conn.State != ConnectionState.Closed))
      {
      this.Conn.Close();
      }  }
      #endregion
     public DataSet GetDataSet(string sql)
      {
      try
      {
      Open();
      Cmd.CommandType = CommandType.StoredProcedure;
      Cmd.CommandText = sql;
      Da = new SqlDataAdapter();
      Da.SelectCommand = Cmd;
      Ds = new DataSet();
      Da.Fill(Ds);
      return Ds;
      }
      catch (Exception e)
      {
      throw new Exception(e.Message, e);
      }
      finally
      {
      Close();
      }
      }
    错就出在 Da.Fill(Ds);
    以上的写法我用了不少企业网站,当访问大一点或者一直刷新的时候就出现以上错误