I was wondering if anyone knows of a way to get the actual T-SQL that must be run by the SqlCommand object (with CommandType from StoredProcedure) before it executes ...
My script includes the optional saving of database operations to a file or MSMQ before the command is actually executed. My guess is that if you create SqlCommand as follows:
Using oCommand As New SqlCommand("sp_Foo") oCommand.CommandType = CommandType.StoredProcedure oCommand.Parameters.Add(New SqlParameter("@Param1", "value1")) oCommand.ExecuteNonQuery() End Using
Terminates the execution of some T-SQL:
EXEC sp_Foo @Param1 = 'value1'
Is this assumption correct? If so, is it possible to somehow restore this actual T-SQL? My goal here is to take advantage of parsing, validation, etc. The use of the SqlCommand class, since I will use it anyway. Is it possible? Am I really wrong? Thanks in advance for any input!
source share