Chris 1 thing you should probably wrap SQL.Add calls in a BeginUpdate/EndUpdate pair to prevent unnecsary activity on part complete SQL
with Query.SQL do begin BeginUpdate try Add('Select * from table'); Add('where field1 = value2'); Add('and field2 = value2'); finally EndUpdate; end; hth Neven ----- Original Message ----- From: "Chris Reynolds" <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Thursday, November 01, 2001 10:11 AM 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/