2 xmllhf xmllhf 于 2014.03.11 15:38 提问

IListSource 不包含任何数据源。

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;

public partial class _Default : System.Web.UI.Page
{
BookManage bookmanage = new BookManage();
ReaderManage readermanage = new ReaderManage();
protected void Page_Load(object sender, EventArgs e)
{
this.Title = "图书馆管理系统主页";
DataSet bookds = bookmanage.GetBookSort("tb_bookinfo");
gvBookSort.DataSource = bookds;
gvBookSort.DataBind();//出错位置

    DataSet readerds = readermanage.GetReaderSort("tb_reader");
    gvReaderSort.DataSource = readerds;
    gvReaderSort.DataBind();
}
protected void gvBookSort_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowIndex != -1)
    {
        int id = e.Row.RowIndex + 1;
        e.Row.Cells[0].Text = id.ToString();
    }
}
protected void gvReaderSort_RowDataBound(object sender, GridViewRowEventArgs e)
{
    gvBookSort_RowDataBound(sender, e);
}

}

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!