求大牛。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



...全文
182 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
贴那么多栈信息,也还是说明不了什么问题。因为你根本没有说明你的程序是如何 select 数据的。
  • 打赏
  • 举报
回复
引用 楼主 hanlijuncn 的回复:
我用的三层架构,用code smith生成的。 会是 'user.username' 它的原因吗?为什么在其它系统可以获取返回数据
有了bug就要调试到bug产生的原因,这还能找别的理由去否认有bug吗?只有你自己去贴出来你的问题抛出代码,才能回答你是否应该用code smith的问题。像“为什么在其它系统可以获取返回数据”这种问题让人无法回答,因为正是因为有了这种问题所以才需要一些测试工人的。
  • 打赏
  • 举报
回复
还有这么神奇的问题……
大韩 2015-03-29
  • 打赏
  • 举报
回复
如果真是IIS版本原因造成某些语句不能解析,有解决方案没有? IIS7能安装到win2003上吗
大韩 2015-03-29
  • 打赏
  • 举报
回复
这错误会和IIS版本不同有关系吗?开发时用的win2007和win2008,当然跑起来没错误的。另外一个用户的环境是win2003,就出现了这么一个错误提示。除了IIS的 不同,我实在想不起来还有什么不同,系统是一样的,数据库是一样的,.net framework版本也是一样的
江南小鱼 2015-03-29
  • 打赏
  • 举报
回复
引用 4 楼 hanlijuncn 的回复:
这错误会和IIS版本不同有关系吗?开发时用的win2007和win2008,当然跑起来没错误的。另外一个用户的环境是win2003,就出现了这么一个错误提示。除了IIS的 不同,我实在想不起来还有什么不同,系统是一样的,数据库是一样的,.net framework版本也是一样的
撸主别激动 通过记录异常log,先把异常代码定位出来。只有定位到异常,才能对症下药。 我也认为和IIS不会有多大关系,软件在不同的操作系统运行出问题,这个很正常。
於黾 2015-03-27
  • 打赏
  • 举报
回复
数据表里绑定的列名和数据库里的列名不匹配
feiyun0112 2015-03-27
  • 打赏
  • 举报
回复
propertyname应该类似“username”这样的,你看你的代码
jun471537173 2015-03-27
  • 打赏
  • 举报
回复
调试呗。。。

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧