Possible bug in TCSVDataSet? lazarus / 63-Database ---------------------------------------------------------------------- egsuh · 2022-08-26 10:41 I load up a CSV file to TCSVDataSet, and set it active. Then, I go to CSVOptions of TCSVDataSet and set FirstLineAsFieldNames to true. But then there occurs error --- it is not done. I think the first column names --- Column1, Column2, ...  are not cleared. In the FieldDefs of TCSVDataSet, column names are changed to first line, but if I right click on the TCSVDataSet icon and enter Edit Fields, the old field names are alive, and I cannot remove them. ---------------------------------------------------------------------- Zvoni · 2022-08-26 12:46 Sample-Code? What's the "Field"-Delimiter inside the CSV? What did you set as Field-Delimiter in your TCSV-Object? ---------------------------------------------------------------------- wp · 2022-08-26 12:52 When a dataset is active its structure cannot be changed any more. Therefore, I'd propose to FIRST set FirstLineAsFieldNames=true and THEN to set Active=true (untested). ---------------------------------------------------------------------- Thaddy · 2022-08-26 15:17 That is the correct order. ---------------------------------------------------------------------- wp · 2022-08-26 15:54 What is "that"? First set FirstLineAsFieldNames/second set Active, or first set Active/second set FirstLineAsFieldName? ---------------------------------------------------------------------- Thaddy · 2022-08-26 16:19 FirstLineAsFieldNames then second set Active. Active relies on the setup. You can find the proof in the sourcecode. ---------------------------------------------------------------------- wp · 2022-08-26 17:32 Yes, I would have been very much surprised if it were the other way round. ---------------------------------------------------------------------- egsuh · 2022-08-27 04:02 QuoteWhen a dataset is active its structure cannot be changed any more. Therefore, I'd propose to FIRST set FirstLineAsFieldNames=true and THEN to set Active=true (untested). Yes, it's the way that works. But hope there be a way to change the setting. ---------------------------------------------------------------------- Thaddy · 2022-08-27 10:28 Quote from: egsuh on August 27, 2022, 06:02:04 amYes, it's the way that works. But hope there be a way to change the setting. Not on the same Tdataset, you will need another Tdataset for that is the easy way.