我想对数据库的内容分页显示!为什么加了tado.Recordset.PageSize:=2;或tado.Recordset.AbsolutePosition := 1后会出错!难道不能这样用吗?还是要设置tado的属性.除了这两句外其它的代码正常.测试代码如下:
var sql:string;
tado: TADODataSet;
begin sql := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\bonus\data.mdb;Persist Security Info=False';
tado.Recordset.PageSize:=2;
tado := TADODataSet.Create(self);
tado.ConnectionString:=sql;
tado.CommandText:= 'select * from bonus';
DataSource1.DataSet:=tado;
DBGrid1.DataSource:=DataSource1;
tado.Open;
var sql:string;
tado: TADODataSet;
begin sql := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\bonus\data.mdb;Persist Security Info=False';
tado.Recordset.PageSize:=2;
tado := TADODataSet.Create(self);
tado.ConnectionString:=sql;
tado.CommandText:= 'select * from bonus';
DataSource1.DataSet:=tado;
DBGrid1.DataSource:=DataSource1;
tado.Open;
tado: TADODataSet;
begin sql := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\bonus\data.mdb;Persist Security Info=False';
tado := TADODataSet.Create(self);
tado.ConnectionString:=sql;
tado.CommandText:= 'select * from bonus';
DataSource1.DataSet:=tado;
DBGrid1.DataSource:=DataSource1;
tado.Open;
tado.Recordset.PageSize:=2;
要數據集open後才能引用Recordset對象
以为设置PageSize就可实现分页,不是吧!
还有二楼的:要數據集open後才能引用Recordset對象我也试过了,就是不能分页!昏呀!