The first field of the first record that is imported is corrupted with the name of the text file that is being loaded. It looks like a buffer is not being initialised.
The problem can be demonstrated quite easily. Drop a TSQLConnection, TSQLDataSet and TButton on a form. Create a table as follows:
CREATE TABLE corelab ( name VARCHAR(40), id INT)
Create a text file called c:\corelab.txt containing these lines:
The TButton Click handler should contain code like this:
Code: Select all
SQLDataSet1.CommandText := 'LOAD DATA LOCAL INFILE ' + '"c:\corelab.txt" ' + 'INTO TABLE corelab ' + 'FIELDS TERMINATED BY ";" ' + 'LINES TERMINATED BY "\r\n"'; SQLDataSet1.ExecSQL(TRUE); SQLDataSet1.CommandText := 'SELECT * FROM corelab'; SQLDataSet1.Open; ShowMessage ( SQLDataSet1.Fields.AsString );