I created a SqlCommand with an SQL query containing parameters.
I than add all the parameters to the class.
Is there an easy way to see the resulting SQL query before it is sent off to the db?
This would be handy for debugging purposes. (e.g. copying the entire query and run it in the management studio to try and pinpoint problems)
R
No, because no substitution actually happens. The query is passed to the server as is, and the parameters are passed separately.
However, you can write a method to replace parameter placeholders with the actual parameter values… that’s what I did in one of my applications, I’ll post the code as soon as I can.
Here is the code that I use, but it is for an Oracle Lite database, so it will require some adaptations to use it with another RDBMS.