Paul Clapham wrote:Well, he IS using a StringBuilder to construct the big-ass query, so we don't have the dreaded String concatenation problem to deal with. But everything else you said about inserting into the output database one record at a time in batches... +1 to that.
I would have tried to use an "INSERT INTO... FROM SELECT ..." statement, or something like that, so that my code didn't even have to handle the data at all. But perhaps FoxPro doesn't support that kind of query, or perhaps it would have been an unmaintainable mess if it could even be written at all.
How big is your days loop? Also how many records returned from your localTemplate?
Generally speaking making one big ass query (yes big ass query is the technical term) for inserting lot of rows into a database is not reccomended.
c) You will send this big ass query to the database, which will need to parse it and the execute it.
Paul Clapham wrote:Good question. So what does the API documentation say about those methods?
For your first choice it says
Schedules the specified task for execution at the specified time. If the time is in the past, the task is scheduled for immediate execution.
So if the time you provide it is 2011 September 10 03:00:00 then it runs then. I don't see anything which says it will run again at some future time, so I wouldn't assume it would. However you could try it and see.
I will leave you to read the docs for the other method you mentioned and see if that method does what you want.
Incidentally if you want something to happen at 3 AM every day, then "every 24 hours" isn't an accurate way to do that if you live in a place which observes daylight saving time.
Yes, if you use a Timer to cause your application to do something every 24 hours, then it's going to be permanently in memory.