我的原程序是:public static SqlDataReader GetAllDataFromOut_one( )
{
string Dsn=ConfigurationSettings.AppSettings["db"];
string sql="select_all_data_from_out_one";
SqlConnection myconnection=new SqlConnection(Dsn);
SqlCommand mycommand =new SqlCommand(sql,myconnection);
mycommand.Parameters.Add(new SqlParameter("@qishi_one", SqlDbType.DateTime));
mycommand.Parameters["@qishi_one"].Value=count_enter.qishi_one; mycommand.Parameters.Add(new SqlParameter("@jieshu_one", SqlDbType.DateTime));
mycommand.Parameters["@jieshu_one"].Value=count_enter.jieshu_one;
mycommand.CommandType = CommandType.StoredProcedure;
myconnection.Open();
SqlDataReader mydr;
mydr=mycommand.ExecuteReader( CommandBehavior.CloseConnection);
return mydr;
}将其绑定到DATAGRID分页不能作用,不知道为什么?
请各位给看看吧?
private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
if(count_enter.qishi_one=="" && count_enter.jieshu_one=="")
{
DataGrid1.CurrentPageIndex=e.NewPageIndex;
DataGrid1.DataSource=SqlDbAccess.GetAllDataFromOut();
}
else
{
DataGrid1.CurrentPageIndex=e.NewPageIndex;
DataGrid1.DataSource=SqlDbAccess.GetAllDataFromOut_one();
}
DataGrid1.DataBind();
}
分页程序如上
不知道用DATAREADER绑定和DATASET绑定的分页程序是不是一样的写法?
能给我一个思路吗?
感激!
{
string Dsn=ConfigurationSettings.AppSettings["db"];
string sql="select_all_data_from_out_one";
SqlConnection myconnection=new SqlConnection(Dsn);
SqlCommand mycommand =new SqlCommand(sql,myconnection);
mycommand.Parameters.Add(new SqlParameter("@qishi_one", SqlDbType.DateTime));
mycommand.Parameters["@qishi_one"].Value=count_enter.qishi_one; mycommand.Parameters.Add(new SqlParameter("@jieshu_one", SqlDbType.DateTime));
mycommand.Parameters["@jieshu_one"].Value=count_enter.jieshu_one;
mycommand.CommandType = CommandType.StoredProcedure;
myconnection.Open();
SqlDataReader mydr;
mydr=mycommand.ExecuteReader( CommandBehavior.CloseConnection);
return mydr;
}将其绑定到DATAGRID分页不能作用,不知道为什么?
请各位给看看吧?
private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
if(count_enter.qishi_one=="" && count_enter.jieshu_one=="")
{
DataGrid1.CurrentPageIndex=e.NewPageIndex;
DataGrid1.DataSource=SqlDbAccess.GetAllDataFromOut();
}
else
{
DataGrid1.CurrentPageIndex=e.NewPageIndex;
DataGrid1.DataSource=SqlDbAccess.GetAllDataFromOut_one();
}
DataGrid1.DataBind();
}
分页程序如上
不知道用DATAREADER绑定和DATASET绑定的分页程序是不是一样的写法?
能给我一个思路吗?
感激!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货