J
Jason
I have run into this issue a number of times. I have complex parameterized
commands that I am running against an access database. When I get errors
there seems to be no way of seeing the actual SQL statement that is being
run against the server-- i.e., the parameters are replaced by the actual
values.
When I build applications against SQL server I use the SQL trace program on
the server to see the statements. But it would be great if I could somehow
get that in the code, so I could write it to a log or something.
For example:
mycommand.commandtext returns the SQL statement with the parameter
placeholders.
It would be great if there was a way to call:
mycommand.actualSQL and have it return the statement with the parameters
replaced by their coresponding values. Or maybe have it
mydataadapter.update() throw an exception with the actualSQL statement when
the update fails.
How do you all handle this? Am I missing something simple.
Thank you in advance.
commands that I am running against an access database. When I get errors
there seems to be no way of seeing the actual SQL statement that is being
run against the server-- i.e., the parameters are replaced by the actual
values.
When I build applications against SQL server I use the SQL trace program on
the server to see the statements. But it would be great if I could somehow
get that in the code, so I could write it to a log or something.
For example:
mycommand.commandtext returns the SQL statement with the parameter
placeholders.
It would be great if there was a way to call:
mycommand.actualSQL and have it return the statement with the parameters
replaced by their coresponding values. Or maybe have it
mydataadapter.update() throw an exception with the actualSQL statement when
the update fails.
How do you all handle this? Am I missing something simple.
Thank you in advance.