public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string connectionString =
WebConfigurationManager.ConnectionStrings["base"].ConnectionString;
string selectSQL = "SELECT author,book FROM ListItem";
SqlConnection con = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand(selectSQL, con);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adapter.Fill(ds, "ListItem");
grid.DataSource = ds;
grid.DataBind();
}
protected void grid_PageIndexChanged(object sender, EventArgs e)
{
grid.PageIndex=e.NewPageIndex;//have a error grid.DataBind();
}
}
问问题
8070 次