求大牛。A field or property with the name 'user.username' was not found on the
大韩 2015-03-27 02:21:40 我一个asp.net系统(.net4.0,sql server2005)在win7、win8、win2008下部署都能正确执行。在win2003下(已经安装了.net 4.0包),有一个地方老是过不去,不知道问题会是在哪?出错代码如下:
我用的三层架构,用code smith生成的。 会是 'user.username' 它的原因吗?为什么在其它系统可以获取返回数据
Server Error in '/' Application.
--------------------------------------------------------------------------------
A field or property with the name 'user.username' was not found on the selected data source.
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.Web.HttpException: A field or property with the name 'user.username' was not found on the selected data source.
Source Error:
Line 44: gvScore.DataSource = UsOnlineStateManager.GetUserScore(sjID, txtKsKH.Text.Trim(),txtKsName.Text.Trim(),txtKsID.Text.Trim(),radSortType.SelectedValue.ToString().Trim());
Line 45: //gvScore.DataSource = UsOnlineStateManager.GetAllUsOnlineStates();
Line 46: gvScore.DataBind();
Line 47: }
Line 48: protected void btnPrint_Click(object sender, EventArgs e)
Source File: c:\gaoxinPoliceExam\webExam\st\testScore.aspx.cs Line: 46
Stack Trace:
[HttpException (0x80004005): A field or property with the name 'user.username' was not found on the selected data source.]
System.Web.UI.WebControls.BoundField.GetValue(Control controlContainer) +1763627
System.Web.UI.WebControls.BoundField.OnDataBindField(Object sender, EventArgs e) +67
System.Web.UI.Control.OnDataBinding(EventArgs e) +91
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +92
System.Web.UI.Control.DataBind() +15
System.Web.UI.Control.DataBindChildren() +201
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
System.Web.UI.Control.DataBind() +15
System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +166
System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +3896
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +66
System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +14
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +128
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +33
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
System.Web.UI.WebControls.GridView.DataBind() +4
st_testScore.btnSeek_Click(Object sender, EventArgs e) in c:\gaoxinPoliceExam\webExam\st\testScore.aspx.cs:46
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563