标题:小问题
取消只看楼主
makewelldone
Rank: 1
来 自:江苏南京
等 级:新手上路
帖 子:97
专家分:0
注 册:2006-9-25
 问题点数:0 回复次数:1 
小问题

private void Submit1_ServerClick(object sender, System.EventArgs e)
{
string str="select * from Book";
SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]);

if(TextBox1.Text != null)
{
str=str+" where bookname like '%"+TextBox1.Text+"%'";
}

SqlCommand comm = new SqlCommand(str,conn);

SqlDataAdapter da = new SqlDataAdapter(comm);

DataSet ds = new DataSet();



Label1.Text = DataGrid1.PageCount.ToString();


da.Fill(ds ,"Book");

DataGrid1.DataSource =ds;

DataGrid1.DataBind();

}

private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex ;

DataGrid1.DataBind();

}

private void TextBox1_TextChanged(object sender, System.EventArgs e)
{
DataGrid1.CurrentPageIndex=0;

}

private void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)
{

}
为什么在多次查询后,点下一页时出现CURENTPAGEINDEX必须大于0小于PAGECOUT的错误

搜索更多相关主题的帖子: str SqlCommand conn System 
2007-04-10 19:57
makewelldone
Rank: 1
来 自:江苏南京
等 级:新手上路
帖 子:97
专家分:0
注 册:2006-9-25
得分:0 

是有数据的,在多次查询后,点下一页时出错

2007-04-11 18:39



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-130833-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.686078 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved