Raoul Gerbi
Raoul Gerbi

Reputation: 43

Evaluate/Debug an odbcCommand object with parameters

I am using an odbcCommand object in C# to make an update on a table. I was using the '?' as a placeholder and added the parameters to the object. Is there any way to see the serialized command text in which the '?' are already replaced by the value.

This would help alot to debug the program...

Upvotes: 2

Views: 275

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1064184

Is there any way to see the serialized command text in which the '?' are already replaced by the value.

Nope, because parameter values don't usually replace the place-holder. The command-text and parameter-values are sent separately. That is kinda the point of parameters, and is how they avoid issues such as encoding, formatting, and sql-injection.

You could simulate it by looping over the ? in the text, but you'd have to be really careful, because ? could appear in things like comments, where it would not be replaced.

Upvotes: 1

Related Questions