Repeater1 使用的是无效数据源。有效数据源必须实现 IListSource 或 IEnumerable

.Net技术 码拜 8年前 (2016-01-29) 1308次浏览
跳转传id
<a href=”ThirdPage.aspx?id=1″ style=”text-decoration: none”></a>

方法
public DataRow SelectPageid(int id)
{
this.sda = new MySqlDataAdapter(“select  *  from  Thirdpage  where id=@id”, this.conn);
this.sda.SelectCommand.Parameters.AddWithValue(“@id”, id);
this.dt = new DataTable();
this.sda.Fill(this.dt);
return this.dt.Rows[0];
}

aspx.cs代码
ThirdServices ts = new ThirdServices();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string id = Request.QueryString[“id”];
this.Repeater1.DataSource = this.ts.SelectPageid(int.Parse(Request.QueryString[“id”]));
this.DataBind();
}
}
提示      this.Repeater1.DataSource = this.ts.SelectPageid(int.Parse(Request.QueryString[“id”]));错误(Repeater1 使用的是无效数据源),,讨教各位
解决方案:10分
SelectPageid 方法应该返回一个对象集合,而不是一个非集合(单独对象)。
解决方案:30分
返回DataTable看看

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明Repeater1 使用的是无效数据源。有效数据源必须实现 IListSource 或 IEnumerable
喜欢 (0)
[1034331897@qq.com]
分享 (0)