Link to home
Start Free TrialLog in
Avatar of SCOTT78
SCOTT78Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Timers

Hi,

I have written a timer application that performs the following:

Connects to an accounts package and executes a SQL query that returns all of the Sales Orders in the accounts package, the program then loops on the query and inserts all the data into a SQL server 2000 database. Also the program breaks down the data and also performs sorting functions on some of the information.

My problem is that this procedure takes around 1-2 hours to complete one loop of the data. The timer is set to fire 5 seconds after the processing the data has finished. The loop though takes along time to copy and manipulate the data. The amount of records being retrieved is around 2000.
Should the program take this long to process and is there another way of carrying out this procedure.  

I am using a TTimer component and a form. The timer is housed on the form and when the timer fires the collecting and processing of the data is performed in the OnTimer Event.

Any ideas on how to improve the performance or the program itself would be greatly appreciated as I am not a genius programmer but am fairly capable.

I am using Delphi 5 Professional, TTimer and TQuery components and a SQL Server 2000 database and also ODBC for connecting to my accounts package.

Thanks in advance
Sct
ASKER CERTIFIED SOLUTION
Avatar of calinutz
calinutz
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Using DisableControls of TDataSet before operations and  EnableControls may also be helpfull.
But as calinutz says it is difficult to guess.
Avatar of SCOTT78

ASKER

My program gets all Sales Orders from an accounts package using a SQL query, then loops on the querys and copies all the data returned into a SQL Server 2000 database.
This is so that I can manipulate the data without changing the original data in the accounts package.

Hope this helps
Sct
Avatar of wframsay
wframsay

What kind of Database are you querying?  You may be able to optimize performance by either doing your "breaks down the data" and "performs sorting functions" within your initial query.  You might want to select your query into a temporary table, then process the results of that into your SQL Server 2000 database.
Avatar of SCOTT78

ASKER

The database is part of an accounting system, I think it is a 4GL database. It is accessed through the alias in ODBC. Will sending the data to a temp table and then processing the table be quicker than looping on the recordset from the SQL statement?

Thanks
Probably not.  However, doing your "processing" as part of the query might enhance the performance.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial