SQLCommand calls sp_executesql implicitly

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

I am using SQLCommand object to create datasets and open data readers.

I found that on various occassions the same query if I run in Management
Studio runs instantaneously, but within code that query takes too long to
execute.

To investigate I started looking at the SQL Server Profiler, I found a weird
issue.
All my queries that I run through SQLCommand are converted into
"sp_executesql" call.

Why is this happening, and how can I avoid it.

When I run same queries from Management Studio, the profiler shows query
being run without the wrapper of sp_executesql.

Please help.

Thanks.
AM.



.



Relevant Pages