“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------列“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;
}
--------------------------------------------------------------------------------列“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;
}
解决方案 »
- Socket.Send重载的第二个方法中的参数IList是什么意思?
- 【求助】C# Winform 在UserControl1里调用Form1的button1单击事件的问题
- C#
- Click事件参数问题
- vs编译器里,HTML页面中文出现乱码......
- c#2003如何实现 电脑桌面图片,定时更换
- 进度条(ProgressBar)的用法?
- 后台SendMessage,为什么不成功?
- 水晶报表能否先生成几个不同的报表(DataSet不同,内容也不同),然后一起打印?
- 关于sqlserver里数据类型和c#里数据类型的问题,谢谢
- 再次开贴问问题!!!!!!!!!!!!!!!
- MSSQL2000连接数据库问题
Program_type.Id = new Guid(ds.Tables["Table"].Rows[i]["Id"].ToString());DAL读取的数据集中,表Table没有ID这个字段!
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);
以上的写法我用了不少企业网站,当访问大一点或者一直刷新的时候就出现以上错误