Groups | Blog | Home
all groups > dotnet ado.net > march 2008 >

dotnet ado.net : sqlcommand question


param@community.nospam
3/17/2008 1:26:12 PM
Hi all,

I have a SQLCommand object that has been set with a Stored Proc & the
required parameters. I would like to somehow retrieve the sql text that is
sent to sql server as a result of execution of this command object. Is that
possible? So basically I want to extrapolate the text that ultimately looks
like this:

exec storedproc @param1=0, @param2=1.....

TIA!

Cor Ligthert[MVP]
3/18/2008 6:30:05 AM
Param,

This are all properties from your command object, so it is in fact a just
creating a string from those.

Cor

<param@community.nospam> schreef in bericht
news:%23c8FvxFiIHA.1204@TK2MSFTNGP03.phx.gbl...
[quoted text, click to view]
William Vaughn
3/21/2008 11:46:29 AM
There is no mechanism within ADO.NET to fetch the actual command string
that's sent to the server short of using the Profiler.

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
[quoted text, click to view]
AddThis Social Bookmark Button