Forum > Beginners

CSV from a field in a DBGRID

(1/1)

Petrus Vorster:
Hello gurus.

For the last bit of this tool, I need one field from a dbgridview written to a csv.
There are many Fields in the Dbgridview, but I have already formatted the string in the 'MESSAGE' field with its required commas.

So It will just have to be a loop, reading those fields in every record, and then write to a csv....
The other fields you all have shown me already how to update other records.

The CSv is the final part.

Regards,

Peter

Zvoni:

--- Quote from: Petrus Vorster on September 04, 2024, 03:49:26 pm ---Hello gurus.

For the last bit of this tool, I need one field from a dbgridview written to a csv.
There are many Fields in the Dbgridview, but I have already formatted the string in the 'MESSAGE' field with its required commas.

So It will just have to be a loop, reading those fields in every record, and then write to a csv....
The other fields you all have shown me already how to update other records.

The CSv is the final part.

Regards,

Peter

--- End quote ---
And your Problem is what?
How to make a CSV-String from ONE single Column, or from All those Columns in the DBGrid?

Petrus Vorster:
Yeah, silly question if you think about it?
 :D

Zvoni:

--- Quote from: Petrus Vorster on September 04, 2024, 04:08:03 pm ---Yeah, silly question if you think about it?
 :D

--- End quote ---
Well, from ONE Column/Field, or from ALL Columns/Fields?

If ALL Columns: Run through the Columns, fill up an Array of String, call the Join-Function on that Array with Delimiter being Comma, Done

Quoting the Fields might be an idea to think about it, if there might be "nested" commas within the Column-Values

Navigation

[0] Message Index

Go to full version