怎样使视图中的显示数据排序?

xbdvcx2 2004-04-07 03:12:56
为一个表A(字段:编号,年龄,工资等,已经为这三个字段建了索引)建一个视图viewA(在排序依据中也设置了上述三个字段),在一个Grid中显示。有三个按钮,想在按下后使Grid中的显示分别按三个字段排序,如何做?
...全文
47 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
hhhyw 2004-04-08
  • 打赏
  • 举报
回复
有没有刷新表格?
zzizz 2004-04-08
  • 打赏
  • 举报
回复
那就用临时表吧,select * from dbf order by xx into cursor temp ,让临时表在grid中显示.
xbdvcx2 2004-04-08
  • 打赏
  • 举报
回复
不好用,我试过了
hnpyz 2004-04-08
  • 打赏
  • 举报
回复
补充:
Form 的 Unload 事件:
Release lTag
hnpyz 2004-04-08
  • 打赏
  • 举报
回复
Form Init 事件:
Puble lTag
lTag = .T.
sele viewA
inde on 编号 tag 编号
inde on 编号 tag 编号1 desc
inde on 年龄 tag 年龄
inde on 年龄 tag 年龄1 desc
inde on 工资 tag 工资
inde on 工资 tag 工资1 desc
set orde to 1
loca

Grid 的 Column1(编号)的 Header1 的 Click 事件:
if lTag
lTag = .F.
set orde to tag 编号1
else
lTag = .T.
set orde to tag 编号
endi
loca
ThisForm.Refresh()

其他类推。
可以省除按钮,如果加上向上向下的箭头更好。

hxcj 2004-04-07
  • 打赏
  • 举报
回复
同意楼上的使用:set order to indexname
但是要注意,如果打印报表后不希望使用索引,在report命令后再次使用set order to命令
YuyuanJian 2004-04-07
  • 打赏
  • 举报
回复
分别用不同的索引,set order to indexName

2,727

社区成员

发帖
与我相关
我的任务
社区描述
VFP,是Microsoft公司推出的数据库开发软件,用它来开发数据库,既简单又方便。
社区管理员
  • VFP社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧