RecordSet Examples

Contents Hide

  

A record set may be likened to table in a scripted query, as the both contain rows of values.

Example 1. Creating a new RecordSet

rs = new RecordSet("TABLE4");

rs = new RecordSet("TABLE4", vectFieldInfo);

Note:

Example 2. Adding a new Record to a RecordSet

rs = new RecordSet("TABLE4");

 

// record operations to populate the result set ...

record = new Record();

record.add(/*...*/);

// ...  to the empty RecordSet

 

rs.add(record);

Note:

Example 3. Adding Field Info

Once a vector of FieldInfo has been created, it can be passed to a record set with the setFieldInfo method or on the record set's instantiation. Doing this will ensure the data passed between the server and script is of the same type and thus read properly.

vectFieldInfo = new Vector();

//... lines of code populating vectFieldInfo

 

rs = new RecordSet("TABLE4");

rs.setFieldInfo(vectFieldInfo);

vectFieldInfo = new Vector();

//... lines of code populating vectFieldInfo

 

rs = new RecordSet("TABLE4", vectFieldInfo);

Note: