Recent

Author Topic: CSV from a field in a DBGRID  (Read 353 times)

Petrus Vorster

  • Jr. Member
  • **
  • Posts: 69
CSV from a field in a DBGRID
« 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

Zvoni

  • Hero Member
  • *****
  • Posts: 2635
Re: CSV from a field in a DBGRID
« Reply #1 on: September 04, 2024, 03:53:46 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
And your Problem is what?
How to make a CSV-String from ONE single Column, or from All those Columns in the DBGrid?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Petrus Vorster

  • Jr. Member
  • **
  • Posts: 69
Re: CSV from a field in a DBGRID
« Reply #2 on: September 04, 2024, 04:08:03 pm »
Yeah, silly question if you think about it?
 :D

Zvoni

  • Hero Member
  • *****
  • Posts: 2635
Re: CSV from a field in a DBGRID
« Reply #3 on: September 04, 2024, 04:11:17 pm »
Yeah, silly question if you think about it?
 :D
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
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

 

TinyPortal © 2005-2018