UltraLite for M-Business Anywhere 为您执行各种各样的导航任务提供了许多在表中导航的方法。
使用 ULTable 对象的以下方法,您可以在结果集中导航:
moveAfterLast 移至最后一行之后的位置。
moveBeforeFirst 移至第一行之前的位置。
moveFirst 移至第一行。
moveLast 移至最后一行。
moveNext 移至下一行。
movePrevious 移至上一行。
moveRelative 相对于当前行移动一定数量的行。正索引值在表中向前移动,负索引值在表中向后移动,零不移动游标。如果要重新填充行缓冲区,可以使用零。
以下代码打开 customer 表并在其行间滚动。然后,它会显示一个警告,其中包含每个客户的姓氏。
var tCustomer; tCustomer = conn.getTable( "customer", null ); tCustomer.open(); tCustomer.moveBeforeFirst(); While (tCustomer.moveNext()) { alert( tCustomer.getString(3) ); } |
打开表对象时,应用程序可以访问表中的行。缺省情况下,这些行按主键值顺序访问,但您可以指定索引,以便以某种顺序访问行。
以下代码会移动到按 ix_name 索引排序的 customer 表的第一行。
tCustomer = conn.getTable("customer", null ); tCustomer.openWithIndex("ix_name"); tCustomer.moveFirst(); |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |