为什么asp.net的这样绑定不能分页
publicpartialclassadmin_shangping:System.Web.UI.Page{protectedvoidPage_Load(objectsen...
public partial class admin_shangping : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
gridview_init();
dlist_init();
}
}
void gridview_init()
{
SqlConnection conn = new SqlConnection("server=localhost; database=Dn-Cellphone; integrated security =sspi");
conn.Open();
string strsql = "select GoodsID 商品ID,NormID 规格ID,GoodsName 商品名称,GoodsPrice 商品价格,GoodsQuantity 商品数量 from Tb_Goods";
SqlCommand cmd = new SqlCommand(strsql, conn);
SqlDataReader dr = cmd.ExecuteReader();
GridView1.DataSource = dr;
GridView1.DataBind();
conn.Close();
}
运行后提示 “数据源不支持服务器端的数据分页。” 展开
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
gridview_init();
dlist_init();
}
}
void gridview_init()
{
SqlConnection conn = new SqlConnection("server=localhost; database=Dn-Cellphone; integrated security =sspi");
conn.Open();
string strsql = "select GoodsID 商品ID,NormID 规格ID,GoodsName 商品名称,GoodsPrice 商品价格,GoodsQuantity 商品数量 from Tb_Goods";
SqlCommand cmd = new SqlCommand(strsql, conn);
SqlDataReader dr = cmd.ExecuteReader();
GridView1.DataSource = dr;
GridView1.DataBind();
conn.Close();
}
运行后提示 “数据源不支持服务器端的数据分页。” 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询