“/Engtek”应用程序中的服务器错误。
WorkSheetStatus 既不是表 Table 的 DataColumn 也不是 DataRelation。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.ArgumentException: WorkSheetStatus 既不是表 Table 的 DataColumn 也不是 DataRelation。
源错误:
行 94: 行 95: bool isExpired = Convert.ToDateTime(drv["EndDateTime"]) < DateTime.Now;行 96: int workSheetStatus = Convert.ToInt32(drv["WorkSheetStatus"]); 行 97: int precisionSheetStatus = Convert.ToInt32(drv["PrecisionSheetStatus"]); 行 98: |
源文件: d:\Projects\Engtek\System\Maintenance\MaintenanceSchedule\MaintenanceScheduleProcessing.aspx.cs 行: 96
堆栈跟踪:
[ArgumentException: WorkSheetStatus 既不是表 Table 的 DataColumn 也不是 DataRelation。] System.Data.DataRowView.get_Item(String property) +1740730 System_Maintenance_MaintenanceSchedule_MaintenanceScheduleProcessing.GvMaintenanceSchedule_RowDataBound(Object sender, GridViewRowEventArgs e) in d:\Projects\Engtek\System\Maintenance\MaintenanceSchedule\MaintenanceScheduleProcessing.aspx.cs:96 System.Web.UI.WebControls.GridView.OnRowDataBound(GridViewRowEventArgs e) +108 System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +167 System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +2417 System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57 System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +14 System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73 System.Web.UI.WebControls.GridView.DataBind() +4 Insus.NET.InsusPagingUtility.GridViewDataBind(DataTable dt, GridView gv) +71 Insus.NET.InsusPagingUtility.GridViewDataBind(DataTable dt, UserControl uc, GridView gv, Panel pl, Int32 PageSize) +235 System_Maintenance_MaintenanceSchedule_MaintenanceScheduleProcessing.Data_Binding() in d:\Projects\Engtek\System\Maintenance\MaintenanceSchedule\MaintenanceScheduleProcessing.aspx.cs:48 System_Maintenance_MaintenanceSchedule_MaintenanceScheduleProcessing.Page_Load(Object sender, EventArgs e) in d:\Projects\Engtek\System\Maintenance\MaintenanceSchedule\MaintenanceScheduleProcessing.aspx.cs:39 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.3053; ASP.NET 版本:2.0.50727.3053
问题原因与解决办法:
在修改程序时,出现上面这个异常。由于在数据库表中,添加了字段,再加上程序显示数据时,并非是SELECT * FROM ...
而是指定字段,当在预览程序时,出现上面的异常。在存储过程中的SELECT语句,添加上此字段。即可解决。