Icon ImportTable Method

procedure ImportTable(const FileToImport: String; Delimiter:
      Char; ReadHeaders: Boolean=False; FieldsToImport: TStrings=nil;
      const DateFormat: String=ANSI_DATE_FORMAT; const TimeFormat:
      String=ANSI_TIME_FORMAT; DecSeparator:
      Char=ANSI_DECIMAL_SEPARATOR)

Usage

Call the ImportTable method to import data into the dataset from a delimited text file. The dataset may be open or closed when executing this method.

The FileToImport parameter indicates the name (including path) of the delimited text file to import into the dataset.

The Delimiter parameter indicates the char used as the delimiter in the text file being imported into the dataset.

The ReadHeaders parameter indicates whether to read the field names to be imported directly from the first line of the text file being imported.

The FieldsToImport parameter indicates the names of the fields that should be populated with data from the incoming delimited text file. This is useful for situations where the structure of the incoming data does not match that of the dataset.

The DateFormat parameter indicates the date formatting to be used for interpreting any incoming date or timestamp (date and time) fields in the imported text file. The rules for the date format specification are the same as with Delphi, Kylix, and C++Builder date formats. The only restriction is that you must include a date separator between the year (y), month (m), and day (d) placeholders. When importing timestamp fields the formatting is assumed to be DateFormat, space character, and then TimeFormat. All formatting is case-insensitive and the default date format is "yyyy-mm-dd".

The TimeFormat parameter indicates the time formatting to be used for interpreting any incoming time or timestamp (date and time) fields in the imported text file. The rules for the time format specification are the same as with Delphi, Kylix, and C++Builder time formats. The only restriction is that you must include a time separator between the hours (h), minutes (m), and seconds (s) placeholders. Also, any milliseconds formatting must use a period "." as the separator between the seconds and the milliseconds placeholders. Finally, when specifying the "ampm" switch for 12-hour clock format, do not use a forward slash between the "am" and "pm" placeholders. When importing timestamp fields the formatting is assumed to be DateFormat, space character, and then TimeFormat. All formatting is case-insensitive and the default time format is "hh:mm:ss.zzz ampm".

The DecSeparator parameter indicates the decimal separator to be used for interpreting any incoming number fields (Float or BCD) in the imported text file. DBISAM does not support the use of thousands separators in incoming number field text data, only decimal separators. The default decimal separator is ".".
Image