Here is how I solved a similar problem. I also first tried traversing through a grid, much like the method suggested by Greg. But I was unable to get this to work. I could not get the grid to update proper apparently, so I would constantly get the values from the first row only... anywho; I finally decided to let the MySQL database create the CSV file. Which is way faster as well. A drawback to this method though, is that it works only at the PC where the MySQL database is running.
Create an external database connection, and let us name it "DBx". Now you want to run an SQL statement which creates the CSV file. Something akin to this:
// Run SQL-statement $DBExecute( "DBx" , $SQLCmd )
This will create the following file C:\temp\mycsv.txt
The completed SQL will look something like this:
SELECT Time_Stamp, Field1, Field2 INTO OUTFILE '/temp/mycsv.csv' FIELDS TERMINATED BY ',' ESCAPED BY '\\' LINES TERMINATED BY '\n' FROM Table1 WHERE Time_Stamp >= '2013-12-24 09:30:00' AND Time_Stamp <= '2013-12-24 21:30:00';
Check MySQL resources for additional parameters for this approach.
Here is how I solved a similar problem. I also first tried traversing through a grid, much like the method suggested by Greg. But I was unable to get this to work. I could not get the grid to update proper apparently, so I would constantly get the values from the first row only... anywho; I finally decided to let the MySQL database create the CSV file. Which is way faster as well. A drawback to this method though, is that it works only at the PC where the MySQL database is running.
Create an external database connection, and let us name it "DBx". Now you want to run an SQL statement which creates the CSV file. Something akin to this:
// Run SQL-statement $DBExecute( "DBx" , $SQLCmd )
This will create the following file C:\temp\mycsv.txt
The completed SQL will look something like this:
SELECT Time_Stamp, Field1, Field2 INTO OUTFILE '/temp/mycsv.csv' FIELDS TERMINATED BY ',' ESCAPED BY '\\' LINES TERMINATED BY '\n' FROM Table1 WHERE Time_Stamp >= '2013-12-24 09:30:00' AND Time_Stamp <= '2013-12-24 21:30:00';
Check MySQL resources for additional parameters for this approach.