IDtObject.Open

Syntax

Open;

Description

The Open method opens data provider or data consumer.

Example

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

Sub UserProc;
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 UserProc;

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:

IDtObject