急呀!!代码是自带的程序生成的,没有改过,应该没有错的
protected System.Web.UI.WebControls.DataGrid MyDataGrid;
protected System.Web.UI.HtmlControls.HtmlForm form1;
protected Wuqi.Webdiyer.AspNetPager AspNetPager1;
private SqlConnection cn = new SqlConnection(); SqlConnection conn;
SqlCommand cmd;
void Page_Load(object src,EventArgs e)
{
conn=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["SiteDsn"]);
if(!Page.IsPostBack)
{
cmd=new SqlCommand("Home_Product_List",conn);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add("@pageindex",1);
cmd.Parameters.Add("@pagesize",1);
cmd.Parameters.Add("@docount",true);
conn.Open();
AspNetPager1.RecordCount=(int)cmd.ExecuteScalar();
conn.Close();
BindData();
}
} void BindData()
{
cmd=new SqlCommand("Home_Product_List",conn);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add("@pageindex",AspNetPager1.CurrentPageIndex);
cmd.Parameters.Add("@pagesize",AspNetPager1.PageSize);
cmd.Parameters.Add("@docount",false);
conn.Open();
MyDataGrid.DataSource=cmd.ExecuteReader();
MyDataGrid.DataBind();
conn.Close();
}
void ChangePage(object src,PageChangedEventArgs e)
{
AspNetPager1.CurrentPageIndex=e.NewPageIndex;
BindData();
}
protected System.Web.UI.WebControls.DataGrid MyDataGrid;
protected System.Web.UI.HtmlControls.HtmlForm form1;
protected Wuqi.Webdiyer.AspNetPager AspNetPager1;
private SqlConnection cn = new SqlConnection(); SqlConnection conn;
SqlCommand cmd;
void Page_Load(object src,EventArgs e)
{
conn=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["SiteDsn"]);
if(!Page.IsPostBack)
{
cmd=new SqlCommand("Home_Product_List",conn);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add("@pageindex",1);
cmd.Parameters.Add("@pagesize",1);
cmd.Parameters.Add("@docount",true);
conn.Open();
AspNetPager1.RecordCount=(int)cmd.ExecuteScalar();
conn.Close();
BindData();
}
} void BindData()
{
cmd=new SqlCommand("Home_Product_List",conn);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add("@pageindex",AspNetPager1.CurrentPageIndex);
cmd.Parameters.Add("@pagesize",AspNetPager1.PageSize);
cmd.Parameters.Add("@docount",false);
conn.Open();
MyDataGrid.DataSource=cmd.ExecuteReader();
MyDataGrid.DataBind();
conn.Close();
}
void ChangePage(object src,PageChangedEventArgs e)
{
AspNetPager1.CurrentPageIndex=e.NewPageIndex;
BindData();
}
解决方案 »
- 求个正则
- 我的.net网站换了服务器数据还原了下。。提交订单后就报错了
- FckEdit上传图片时,不能浏览服务器?
- 导出非文字信息(如chart)到excel
- 各位大侠,帮帮忙啊!!!
- 请教大侠~!!!!!!!!!!!!!
- 100分求两个简单的问题,没什么以外的话,晚饭吃好了结
- 请问用C#写的ASP.net页面中怎样调用sql server存储过程
- 高分求购mybatis 的orm的xml 模板 多谢!急用。。。。。
- [求助]我在.net下新建ASP.NETWEB项目出现的问题
- 哪里有免费支持aspx的主页空间?自己可以穿aspx网页,而且支持sql数据库?
- 怀疑dotnetfx.exe坏了,怎样卸载dotnetfx.exe.
好象要家上这个东西的把DataGrid1.CurrentPageIndex=e.pageindex .....