R
redhawk
Unregistered / Unconfirmed
GUEST, unregistred user!
我在delphi8中创建了DataGrid,并连接了ORACLE数据库,DataGrid取得了数据,设置了分页功能,但是点击下一页和上一页,不能变换DataGrid内容,还是第一页的内容,写了DataGrid1_PageIndexChanged事件,给如何实现分页?能提供一个源程序吗?谢谢!
我的代码如下,DataGrid的数据我要动态的更新。
procedure TWebForm1.Button6_Click(sender: System.Object;
e: System.EventArgs);
begin
OracleDataAdapter1.SelectCommand.CommandText:='select ch,sj,thl,ghl,fxy from D14_HYS_YLYFXBB_1_1 order by ch';
OracleDataAdapter1.Fill(Dataset1);
DataView1:=DataSet1.Tables[0].DefaultView;
DataGrid2.VirtualItemCount:=DataView1.Count;
DataGrid2.CurrentPageIndex:=0;
DataGrid2.DataSource:=DataView1;
DataGrid2.DataBind();
end;
procedure TWebForm1.DataGrid2_PageIndexChanged(source: System.Object;
e: System.Web.UI.WebControls.DataGridPageChangedEventArgs);
begin
DataGrid2.CurrentPageIndex:=e.NewPageIndex;
OracleDataAdapter1.SelectCommand.CommandText:='select ch,sj,thl,ghl,fxy from D14_HYS_YLYFXBB_1_1 order by ch';
OracleDataAdapter1.Fill(Dataset1);
DataView1:=DataSet1.Tables[0].DefaultView;
DataGrid2.VirtualItemCount:=DataView1.Count;
//DataGrid2.CurrentPageIndex:=0;
DataGrid2.DataSource:=DataView1;
DataGrid2.DataBind();
end;
我的代码如下,DataGrid的数据我要动态的更新。
procedure TWebForm1.Button6_Click(sender: System.Object;
e: System.EventArgs);
begin
OracleDataAdapter1.SelectCommand.CommandText:='select ch,sj,thl,ghl,fxy from D14_HYS_YLYFXBB_1_1 order by ch';
OracleDataAdapter1.Fill(Dataset1);
DataView1:=DataSet1.Tables[0].DefaultView;
DataGrid2.VirtualItemCount:=DataView1.Count;
DataGrid2.CurrentPageIndex:=0;
DataGrid2.DataSource:=DataView1;
DataGrid2.DataBind();
end;
procedure TWebForm1.DataGrid2_PageIndexChanged(source: System.Object;
e: System.Web.UI.WebControls.DataGridPageChangedEventArgs);
begin
DataGrid2.CurrentPageIndex:=e.NewPageIndex;
OracleDataAdapter1.SelectCommand.CommandText:='select ch,sj,thl,ghl,fxy from D14_HYS_YLYFXBB_1_1 order by ch';
OracleDataAdapter1.Fill(Dataset1);
DataView1:=DataSet1.Tables[0].DefaultView;
DataGrid2.VirtualItemCount:=DataView1.Count;
//DataGrid2.CurrentPageIndex:=0;
DataGrid2.DataSource:=DataView1;
DataGrid2.DataBind();
end;