It *may* make a difference, but try adding - then a prepare should only
happen on the EndUpdate.

TStrings.BeginUpdate
try
  TStrings.Add()
finally
 TStrings.EndUpdate
end

Myles.


-----Original Message-----
From: Chris Reynolds [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 1 November 2001 10:11 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: ADO->SQL Server metadata frenzy



I was just reorganizing some of my database routines yesterday and I noticed
that after my 'improvements', there was a phenomenal increase in SQL Server
activity.

As now I understand it (maybe), if you have a TADOQuery with a connection,
then every time you programmatically change the SQL Tstrings, the SQLOLEDB
driver will squirt the SQL off to the database and do a prepare/unprepare to
check the syntax. So if you are building the strings on the fly with 3 or 4
add() calls, then you will get 3 or 4 round trip syntax checks and that is
BEFORE you have thought of opening the query.

Up until yesterday, I was :-
  creating the query
  building the SQL
  explicitly adding the connection
  opening the query  (2 round trips, one for parameter metadata and one for
data)

In my desire for tidiness, what I tried to do was :-
  creating the query (implicitly adding the connection)
  building the SQL  (2 round trips per SQL line added)
  opening the query  (2 round trips, one for parameter metadata and one for
data)

My solution has been to move the implicit connection inside the open. It all
seems suprising simple AFTER the event.


Setting the isolation level seemed to have no effect on  the metadata round
trips.




---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to