BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Prepared property of ADO components

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Bahamut
Guest





PostPosted: Tue Feb 10, 2004 10:15 am    Post subject: Prepared property of ADO components Reply with quote



Hi, All

I'm using Delphi 6 Enterprise + MSSQLServer2000 on Win2K.
I use TADOCommand to update data with a parameterized sql statement like:

update Table1
set Field1 = :F1
where KeyField = :KeyField

and the command will be executed more than once using the different
parameter values:

while <expression> do
begin
Command.Parameters.ParamValues['F1'] := <ValueWillBeChangedEveryLoop>
Command.Parameters.ParamValues['KeyField'] :=
<ValueWillBeChangedEveryLoop>
Command.Execute;
end;

DelphiHelp say "the performance is enhanced if the query is prepared before
execution, particularly if it is a parameterized query that is executed more
than once using the same parameter values"......
How does the Prepared property of TADODataset and TADOCommand work in this
instance? (execute more than once using the different parameter values)

Can I set Prepared property to True before the Loop?
or set Prepare to True and set to False after Execute in each loop ?

Bahamut



Back to top
Mike Collier
Guest





PostPosted: Tue Feb 10, 2004 7:28 pm    Post subject: Re: Prepared property of ADO components Reply with quote



Quote:
DelphiHelp say "the performance is enhanced if the query is prepared
before
execution,

From what I read in Microsoft newsgroups, SQL Server does some caching of
the SQL. So it doesn't make much difference is you use the prepared option.

--
Mike Collier
www.adoanywhere.com





Back to top
Bahamut
Guest





PostPosted: Wed Feb 11, 2004 2:46 am    Post subject: Re: Prepared property of ADO components Reply with quote



Thanks for your reply!

I also read an article about Prepared in ADO from MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvbdev00/html/vb00j1.asp
It's the same to the viewpoint of you, but I want to know the operation
principle of Prepared in Delphi ADO components...

Does it compile a parameterized SQL "with the value of parameter" to a
temporary stored procedures?
If I change the value of parameter(not change the SQL statement), does it
need to re-prepare the SQL?

Bahamut


"Mike Collier" <noEmail@noEmail> ?¤J?¥ó
news:402930c5 (AT) newsgroups (DOT) borland.com...
Quote:
DelphiHelp say "the performance is enhanced if the query is prepared
before
execution,

From what I read in Microsoft newsgroups, SQL Server does some caching of
the SQL. So it doesn't make much difference is you use the prepared
option.

--
Mike Collier
www.adoanywhere.com









Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.