Dataset.Fetch

Top  Previous  Next

 

Syntax

function Dataset.Fetch(ADataset: pointer; var Values: array; FieldIndex: integer; Count: integer): boolean

 

Description

Fetches multiple field values from dataset ADataset into the array Values. The first field value is given by the FieldIndex and from there, Count fields will be fetched into the array. If Count is NULL or zero, it will fetch data for all fields.

 

See also

Dataset.GetField
Dataset.Next

 

Example

execute udsblock()

returns(r_int integer, r_varchar varchar(100), r_num numeric(15, 2))

as

begin

  /* create the data set */

  select employeeid, emp_name, salary, bonus_perc

  from test_data order by employeeid

  as dataset mydata;

  try 

    fetched_data = null;

    while not Dataset.EOF(mydata)

    do begin

         /* fetch all fields into the array */

              Dataset.Fetch(mydata, fetched_data, 0, Dataset.FieldCount(mydata));

 

         /* fetched_data array now holds data, output some values to the script output parameters */

     r_int = fetched_data[0];

     r_varchar = fetched_data[1];

     r_num = fetched_data[5];

     suspend;

 

         Dataset.Next(mydata);

   end

  finally

    Dataset.Close(mydata);

  end        

end