DataBinding:“System.Data.DataRowView”不包含名为“BookClassName”的属性。

xiaochao198818 2008-11-10 12:21:02
帮帮忙,不知哪里错了...
绑定datalist:
protected void Page_Load(object sender, EventArgs e)
{
string bookclassid= Request.QueryString["BookClassId"].ToString();
string seastr = "select * from Book where BookClassId=" + bookclassid;
Database db = new Database();
DataSet ds = db.GetDataSet(seastr);
DataList1.DataSource = ds;
DataList1.DataBind();
}

datalist在源码里的代码:
<asp:DataList ID="DataList1" runat="server" RepeatColumns="3" Width="620px">
<ItemTemplate>
<div style="text-align: center">
<table style="width: 180px">
<tr>
<td rowspan="3" style="width: 90px">
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='<%# Eval("PictureUrl") %>' /></td>
<td style="width: 100px">
<asp:Label ID="Label1" runat="server" Text='<%# Eval("BookClassName") %>' Width="60px"></asp:Label>
</td>
</tr>
<tr>
<td style="width: 100px">
价格:<asp:Label ID="Label2" runat="server" Text='<%# Eval("Price") %>' Width="60px"></asp:Label></td>
</tr>
<tr>
<td style="width: 100px">
折扣价:<asp:Label ID="Label3" runat="server" Text='<%# Eval("DisPrice") %>' Width="1px"></asp:Label></td>
</tr>
<tr>
<td colspan="2">
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="#" Width="90px">详细信息</asp:HyperLink></td>
</tr>
</table>
</div>
</ItemTemplate>
</asp:DataList>
...全文
455 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaochao198818 2008-11-10
  • 打赏
  • 举报
回复
找到原因是了,是我把BookName写成BookClassName了,各位说的对,Book表里有BookName这个字段没有BookClassName这个字段,是我写错了,呵呵....谢谢各位啦.
xiaochao198818 2008-11-10
  • 打赏
  • 举报
回复
找到原因是了,是我把BookName写成BookClassName了,各位说的对,Book表里有BookName这个字段没有BookClassName这个字段,是我写错了,呵呵....谢谢各位啦.
xiaochao198818 2008-11-10
  • 打赏
  • 举报
回复
除了这个原因,还有没有其他原因啊?我的Book表里有BookName这个字段的
twtetg 2008-11-10
  • 打赏
  • 举报
回复
应该是这个原因
xiaochao198818 2008-11-10
  • 打赏
  • 举报
回复
Book表里有BookClassName这个字段
peterb 2008-11-10
  • 打赏
  • 举报
回复
缺少该字段吧 仔细检查一下
dd__dd 2008-11-10
  • 打赏
  • 举报
回复
Book表里有BookClassName这个字段吗?
Jeff20040819 2008-11-10
  • 打赏
  • 举报
回复
up

110,567

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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