Forum > Database

Dataset's saving to CSV format

(1/1)

egsuh:
I feel like it is good to have a function like SaveToCSVFile, etc. for DataSets.  Currently I can use TCSVDataSet.CopyFromDataSet, and then TCSVDataSet.SaveToCSV to export to CSV file.

This is done correctly, but as noted already, this causes some problem.

https://forum.lazarus.freepascal.org/index.php?topic=49096.0

I have read that there is a package named dBExport, which I haven't tried yet.

I think saving datasets directly to CSV would be very good, via another method of TDataSet.SaveToCSV, or adding CSV format to TDataPacketFormat. 

wp:
Not a good idea. Where does it stop? The next user needs export to DBF which would pull all DBF code into the standard TDataset codebase, or another user needs export to SQLite3 which would make TDataset dependent on sqlite3 etc. Just to save you from typing some code?

Yes, you should have a look at the dbExport package. This is the way to go. And you don't even have to type any code (if you're lucky).

Navigation

[0] Message Index

Go to full version