关于在VFP中用表格控件浏览数据表时的分页浏览
2007-04-02 18:57
411 查看
有一数据表ax.dbf,字段若干
有一表单,设置表格控件1个(grid1),按钮控件5个(功能分别为打开表、分页、上一页、下一页、关闭表)
假设所有文件都放在桌面上
要实现的功能是分页浏览
表单init代码
public rno,rc,pno,pc
SET SAFETY OFF
set path to C:/Documents and Settings/jwc/桌面/
打开表按钮click代码
select (select(1))
use ax.dbf
thisform.lockscreen=.t.
thisform.grid1.recordsourcetype=1
thisform.grid1.recordsource="ax"
thisform.lockscreen=.f.
分页按钮click代码
thisform.lockscreen=.t.
close databases
select (select(1))
use ax
goto top
rno=recno()
rc=reccount()
pno=1
pc=iif(rc/5-int(rc/5)>0,int(rc/5)+1,int(rc/5))
if file("axtemp.dbf")
if used("axtemp")
select axtemp
use
endif
delete file ax.temp
endif
copy to axtemp next 5
select (select(1))
use axtemp
thisform.grid1.recordsourcetype=1
thisform.grid1.recordsource="axtemp"
thisform.lockscreen=.f.
上一页按钮click代码
if pno=1
messagebox("first")
else
thisform.lockscreen=.t.
close databases
select (select(1))
use ax
rc=reccount()
pc=iif(rc/5-int(rc/5)>0,int(rc/5)+1,int(rc/5))
pno=pno-1
rno=pno*5-4
if file("axtemp.dbf")
if used("axtemp")
select axtemp
use
endif
delete file ax.temp
endif
goto (rno)
copy to axtemp next 5
select (select(1))
use axtemp
thisform.grid1.recordsourcetype=1
thisform.grid1.recordsource="axtemp"
thisform.lockscreen=.f.
endif
下一页按钮click代码
if pno=pc
messagebox("last")
else
thisform.lockscreen=.t.
close databases
select (select(1))
use ax
rc=reccount()
pc=iif(rc/5-int(rc/5)>0,int(rc/5)+1,int(rc/5))
pno=pno+1
rno=pno*5-4
if file("axtemp.dbf")
if used("axtemp")
select axtemp
use
endif
delete file ax.temp
endif
goto (rno)
if rc-rno<5
copy to axtemp next (rc-rno)
else
copy to axtemp next 5
endif
select (select(1))
use axtemp
thisform.grid1.recordsourcetype=1
thisform.grid1.recordsource="axtemp"
thisform.lockscreen=.f.
endif
关闭表按钮click代码
close databases
完成
有一表单,设置表格控件1个(grid1),按钮控件5个(功能分别为打开表、分页、上一页、下一页、关闭表)
假设所有文件都放在桌面上
要实现的功能是分页浏览
表单init代码
public rno,rc,pno,pc
SET SAFETY OFF
set path to C:/Documents and Settings/jwc/桌面/
打开表按钮click代码
select (select(1))
use ax.dbf
thisform.lockscreen=.t.
thisform.grid1.recordsourcetype=1
thisform.grid1.recordsource="ax"
thisform.lockscreen=.f.
分页按钮click代码
thisform.lockscreen=.t.
close databases
select (select(1))
use ax
goto top
rno=recno()
rc=reccount()
pno=1
pc=iif(rc/5-int(rc/5)>0,int(rc/5)+1,int(rc/5))
if file("axtemp.dbf")
if used("axtemp")
select axtemp
use
endif
delete file ax.temp
endif
copy to axtemp next 5
select (select(1))
use axtemp
thisform.grid1.recordsourcetype=1
thisform.grid1.recordsource="axtemp"
thisform.lockscreen=.f.
上一页按钮click代码
if pno=1
messagebox("first")
else
thisform.lockscreen=.t.
close databases
select (select(1))
use ax
rc=reccount()
pc=iif(rc/5-int(rc/5)>0,int(rc/5)+1,int(rc/5))
pno=pno-1
rno=pno*5-4
if file("axtemp.dbf")
if used("axtemp")
select axtemp
use
endif
delete file ax.temp
endif
goto (rno)
copy to axtemp next 5
select (select(1))
use axtemp
thisform.grid1.recordsourcetype=1
thisform.grid1.recordsource="axtemp"
thisform.lockscreen=.f.
endif
下一页按钮click代码
if pno=pc
messagebox("last")
else
thisform.lockscreen=.t.
close databases
select (select(1))
use ax
rc=reccount()
pc=iif(rc/5-int(rc/5)>0,int(rc/5)+1,int(rc/5))
pno=pno+1
rno=pno*5-4
if file("axtemp.dbf")
if used("axtemp")
select axtemp
use
endif
delete file ax.temp
endif
goto (rno)
if rc-rno<5
copy to axtemp next (rc-rno)
else
copy to axtemp next 5
endif
select (select(1))
use axtemp
thisform.grid1.recordsourcetype=1
thisform.grid1.recordsource="axtemp"
thisform.lockscreen=.f.
endif
关闭表按钮click代码
close databases
完成
相关文章推荐
- 关于easyui-datagrid数据表格, 分页取出数据
- 关于jsp+mysql+tomcat数据表格分页的解决方案
- 自己实现的数据表格控件(dataTable),支持自定义样式和标题数据、ajax等各种自定义设置以及分页自定义
- 自己实现的数据表格控件(dataTable),支持自定义样式和标题数据、ajax等各种自定义设置以及分页自定义
- [原创]关于easyui下datagrid表格控件分页控制(非url方式)
- 关于layui数据表格的分页操作的学习笔记。
- 17个使用AJAX技术的数据表格控件解决方案(Data Grids with AJAX, DHTML and JavaScript)
- js 分页、表格、生成数据
- 使用DataList分页显示数据,双向排序,添加checkbox控件。
- 关于陕北吴旗娃老师的分页控件
- ExtJS中表格控件的使用,属性设置和数据的获取(copyfrom:http://www.itzhai.com/extjs-form-controls-in-the-use-of-property-)
- 使用zTree控件制作的表格形式的树形+数据菜单
- .net关于控件绑定字段的数据类型
- 使用C1TrueDBGrid表格控件实现数据绑定、分组和过滤功能
- asp.net实现数据分页的控件代码
- ExtJS中表格控件的使用,属性设置和数据的获取
- 如何利用ccform自定义表单来增加自己的控件,关于Sys_FrmEle表结构与数据存储设计?
- 【干货】再上数据分页控件 ━ 更加灵活,更加实用-提供源码
- 利用ListView和DataPager控件来对数据分页
- 打造通用ASP.NET数据分页控件