求高手!! using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class photoAlbum : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bing();
}
}
public void Bing()
{
string SQL = "select * from TypeIMG ";
Jerry.SQLServer db = new Jerry.SQLServer();
DataSet ds = db.select(SQL); Repeater1.DataSource = ds.Tables["content"].DefaultView; Repeater1.DataBind();
}
}
1楼给的是容错
string SQL = "select * from TypeIMG";也就是没得数据,你看看ds读取到数据没有,看一下ds.Table[0].Rows.Count ------解决方案--------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class photoAlbum : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bing();
}
}
public void Bing()
{
string SQL = "select * from TypeIMG ";
Jerry.SQLServer db = new Jerry.SQLServer();
DataSet ds = db.select(SQL);
Repeater1.DataSource = ds;
Repeater1.DataBind();
}
}