Board index » delphi » When to use "prepared" with and TADOQuery

When to use "prepared" with and TADOQuery

with BDE queries, I would explicitly prepare a query if i was going to be
using it again and again with just the parameter values changing.

In reading the documentation on ADO queries, I am not so sure that this is
necessary or desireable, but I really can't tell.

I'm going to be stepping through one dataset, and doing an insert query for
each row.  speed is an issue.

Any thoughts?

 

Re:When to use "prepared" with and TADOQuery


Quote
"Kirk Evans" <wkev...@alltel.net> wrote in message

news:3d18c5b5$1_1@dnews...

Quote
> with BDE queries, I would explicitly prepare a query if i was going to be
> using it again and again with just the parameter values changing.

> In reading the documentation on ADO queries, I am not so sure that this is
> necessary or desireable, but I really can't tell.

> I'm going to be stepping through one dataset, and doing an insert query
for
> each row.  speed is an issue.

> Any thoughts?

Which database are you using ? Here's an article discussing Prepared in ADO
which suggests it's of little value for SQL Server.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvb...
tml/vb00j1.asp

I suppose the best bet is to expirement and see if Prepared = true or false
is faster or not on your machine. Sceppa's book "Programming ADO" also
suggests leaving Prepared = false, and he says setting it to true may
actually slow things down! One other thing, when you are stepping through
the first dataset, make sure to call DisableControls on it if using
client-side cursors, as that will be much faster.

Andy Mackie.

Re:When to use "prepared" with and TADOQuery


Kirk,
i found that setting the prepared to True
really messes things up
heck sometimes the query doesn't run at all
so i stay far away from this mysterious beast
also be very carefull by setting the cursorlocation, i found that playing
with this in the same connection give strange results also, so stick to the
same cursorlocation for the same connection
(applies to Sql Server)
cu
marc

"Kirk Evans" <wkev...@alltel.net> schreef in bericht
news:3d18c5b5$1_1@dnews...

Quote
> with BDE queries, I would explicitly prepare a query if i was going to be
> using it again and again with just the parameter values changing.

> In reading the documentation on ADO queries, I am not so sure that this is
> necessary or desireable, but I really can't tell.

> I'm going to be stepping through one dataset, and doing an insert query
for
> each row.  speed is an issue.

> Any thoughts?

Other Threads