使用Select进行数据库操作固然简单易用,但如果将一些检索操作分解为等价的手工检索代码,则对数据库的检索速度将大大加快.分解的基本方法是对检索关键字段进行索引,利用Seek方法定位后,根据索引的数据库已经排序的特点,进行遍历查找.对于遍历范围不是很宽时,这种方法能几十倍的提高数据库的访问速度.例如:Select
* from person where vol= '123' and birth= #11-02-73#
分解成下面的操作后,访问速度可大大提高:
Table.Index= "vol"Table.Seek "=","123"if not table.nomatch then
while not table.eof if table("vol")="123" then
table.movelast else if table("Birth")= #11-02-73# then
'找到记录 end if table.movenext wendend if