IDtProvider.Fetch

Syntax

Fetch(Var Values: Array);

Parameters

Values - one-dimensional array, to which the read values of the current entry of the data provider are placed.

Description

The Fetch method reads data of the current entry from the data provider. After reading the cursor in the provider moves to the next entry.

Example

Executing the example requires the Data.xls file in the disk C root directory.

Sub Main;

Var

ExcelProvider: IDtExcelProvider;

v: Array;

i: Integer;

Begin

ExcelProvider := New DtExcelProvider.Create;

ExcelProvider.File := "c:\Data.xls";

ExcelProvider.DriverVersion := "Excel 8.0";

ExcelProvider.Query := "Select * From [Sheet1$]";

ExcelProvider.HasHeader := False;

ExcelProvider.Open;

While Not ExcelProvider.Eof Do

ExcelProvider.Fetch(v);

For i := 0 To v.Length - 1 Do

Debug.Write(v[i] + " ");

End For;

Debug.WriteLine("");

End While;

ExcelProvider.Close;

End Sub Main;

After executing the example a new data provider that imports data from Excel file is created. Values of all entries are read from the file, the first row is not regarded as the row that contains field names. Obtained values are displayed in the development environment console.

See also:

IDtProvider