日期:2014-05-17  浏览次数:20555 次

在选定的数据源上未找到名为“PaperState”的字段或属性。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.Web.HttpException: 在选定的数据源上未找到名为“PaperState”的字段或属性。

源错误: 


行 30: DataSet ds = paper.QueryUserPaperList();  
行 31: GridView1.DataSource = ds;  
行 32: GridView1.DataBind();
行 33: LabelPageInfo.Text = "当前(第" + (GridView1.PageIndex + 1).ToString() + "页 共" + GridView1.PageCount.ToString() + "页)";
行 34: }
 

源文件: e:\莫\在线考试资料\OnLineExamUpdate\Web\UserPaperList.aspx.cs 行: 32 

堆栈跟踪: 


[HttpException (0x80004005): 在选定的数据源上未找到名为“PaperState”的字段或属性。]
  System.Web.UI.WebControls.BoundField.GetValue(Control controlContainer) +414
  System.Web.UI.WebControls.BoundField.OnDataBindField(Object sender, EventArgs e) +60
  System.Web.UI.Control.OnDataBinding(EventArgs e) +80
  System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +198
  System.Web.UI.Control.DataBind() +12
  System.Web.UI.Control.DataBindChildren() +214
  System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +208
  System.Web.UI.Control.DataBind() +12
  System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +221
  System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +3012
  System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +59
  System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +12
  System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +101
  System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +25
  System.Web.UI.WebControls.DataBoundControl.PerformSelect() +140
  System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +68
  System.Web.UI.WebControls.GridView.DataBind() +5
  Web_UserPaperList.InitData() in e:\莫\在线考试资料\OnLineExamUpdate\Web\UserPaperList.aspx.cs:32
  Web_UserPaperList.Page_Load(Object sender, EventArgs e) in e:\莫\在线考试资料\OnLineExamUpdate\Web\UserPaperList.aspx.cs:23
  System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
  System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45
  System.Web.UI.Control.OnLoad(EventArgs e) +80
  System.Web.UI.Control.LoadRecursive() +49
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3748
 
aspx代码:
 <asp:GridView ID="GridView1" runat="server" AllowPaging="true" DataKeyNames ="UserID,PaperID" OnRowDataBound="GridView1_RowDataBound" OnPageIndexChanging="GridView1_PageIndexChanging" PageSize="8" AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" Font-Size="13px" Width="100%" OnRowDeleting="GridView1_RowDeleting">
  <Columns> 
  <asp:BoundField DataField="UserID" HeaderText="UserID" ReadOnly="True"/>