asp.net网站出错,

来源:百度知道 编辑:UC知道 时间:2024/05/10 13:53:06
网站总是出错,提示:
Column 'menuId' does not belong to table Table.
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.ArgumentException: Column 'menuId' does not belong to table Table.

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:

[ArgumentException: Column 'menuId' does not belong to table Table.]
System.Data.DataRow.GetDataColumn(String columnName) +1899231
System.Data.DataRow.get_Item(String columnName) +10
ShunShang._bottom.SubMenuList(Int32 MenuParentId) +229
ShunShang._bottom.Page_Load(Object sender, EventArgs

Column 'menuId' does not belong to table Table.

你可能是导出数据时丢主键了,你应该在导出时没有选择“包括扩展属性”以前我也遇到过这个问题!最好使用DTS包的形式导出!常见问题……

1 是不是线程安全的原因
你是不是采用了其他线程更新了这个datatable 如果这样可能引起这个问题
2 在已有数据源时候重新绑定数据源也可能引起这个问题
试试看这个办法 绑定前重置下
dataGrid1.DataSource = null; //要添加的行
dataGrid1.DataSource = ds;

问题应该出现在connection.Close(); 上。

及时关闭不用的sqldatereader、数据库链接