任何时候,ULTable 对象都位于以下位置之一。
在表的第一行之前。
在表的某一行上。
在表的最后一行之后。
如果 ULTable 对象放置在行上,您可以使用 ULTable get 方法之一获取当前行每一列的值。
以下代码段会从 tCustomer ULTable 对象中检索出三列的值,并在文本框中显示这些值。
var colID, colFirstName, colLastName; colID = tCustomer.schema.getColumnID( "id" ); colFirstName = tCustomer.schema.getColumnID( "fname" ); colLastName = tCustomer.schema.getColumnID( "lname" ); alert( tCustomer.getInt( colID ) ); alert( tCustomer.getString( colFirstName ) ); alert( tCustomer.getString( colLastName ) ); |
也可以使用 ULTable 的方法来设置值。
tCustomer.setString( colLastName, "Kaminski" ); |
通过将值指派给这些属性,您不用在数据库中变更数据的值。
即使是在该表的第一行之前或最后一行之后,您也可以给属性指派值。但是,您不能从列中获取值。例如,以下代码段会生成一个错误。
tCustomer.moveBeforeFirst(); id = tCustomer.getInt( colID ); |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |