L
Lorenz Kahl
Hi,
I was just reading the book "ADO.NET in a Nutshell".
In the chapter on the Command-Object (p. 36) it reads:
"A parameterized command won't improve performance as compared to the
original dynamic SQL statement. Unlike a stored procedure, a
parameterized query isn't stored in the database and isn't precompiled.
The difference is simply one of syntax."
OK. Sounds plausible to me. But i recalled reading something different
to that on MSDN. The article "Best Practices for Using ADO.NET"
(http://msdn.microsoft.com/library/en-us/dnadonet/html/adonetbest.asp?frame=true#adonetbest_topic4)
includes the following:
"The Command.Prepare method can improve the performance of parameterized
commands that are repeated at your data source. Prepare instructs the
data source to optimize the specified command for multiple calls. To use
Prepare effectively, you need to thoroughly understand how your data
source responds to the Prepare call. For some data sources such as SQL
Server 2000, commands are implicitly optimized and a call to Prepare is
unnecessary. For other data sources such as SQL Server 7.0, Prepare can
be effective."
So, who is right? Or am I just getting something wrong and mixed up?
Is the effect of the Prepare()-call specific to the data source?
Does it only work with SPs or also with plain SQL-Text?
Any help will be greatly appreciated.
Thanks in advance,
Lorenz
I was just reading the book "ADO.NET in a Nutshell".
In the chapter on the Command-Object (p. 36) it reads:
"A parameterized command won't improve performance as compared to the
original dynamic SQL statement. Unlike a stored procedure, a
parameterized query isn't stored in the database and isn't precompiled.
The difference is simply one of syntax."
OK. Sounds plausible to me. But i recalled reading something different
to that on MSDN. The article "Best Practices for Using ADO.NET"
(http://msdn.microsoft.com/library/en-us/dnadonet/html/adonetbest.asp?frame=true#adonetbest_topic4)
includes the following:
"The Command.Prepare method can improve the performance of parameterized
commands that are repeated at your data source. Prepare instructs the
data source to optimize the specified command for multiple calls. To use
Prepare effectively, you need to thoroughly understand how your data
source responds to the Prepare call. For some data sources such as SQL
Server 2000, commands are implicitly optimized and a call to Prepare is
unnecessary. For other data sources such as SQL Server 7.0, Prepare can
be effective."
So, who is right? Or am I just getting something wrong and mixed up?
Is the effect of the Prepare()-call specific to the data source?
Does it only work with SPs or also with plain SQL-Text?
Any help will be greatly appreciated.
Thanks in advance,
Lorenz