sqlCommand.CommandText rendered

  • Thread starter Thread starter Skeptical
  • Start date Start date
S

Skeptical

Hello,


I am trying to write a logging component which logs the every sql update and
, delete command passed to the program. My problem is I use bunch of
parameters in my sql command and somehow I need to access rendered sql
statement with all parameter values. I can reconstruct the sql statement but
I am thinking there must be a way to do this more efficiently.

In other words, sqlUpdateCommand1.CommandText simply returns the sql command
without the parameter values. Is there a way to see the sql statement with
the parameter values once the parameters have been populated?

Thanks,
 
Skeptical said:
Hello,


I am trying to write a logging component which logs the every sql update and
, delete command passed to the program. My problem is I use bunch of
parameters in my sql command and somehow I need to access rendered sql
statement with all parameter values. I can reconstruct the sql statement but
I am thinking there must be a way to do this more efficiently.

In other words, sqlUpdateCommand1.CommandText simply returns the sql command
without the parameter values. Is there a way to see the sql statement with
the parameter values once the parameters have been populated?

No. The parameters are only plugged in at the server. The best you can do
is output the parameters after the CommandText by iterating the command
parameters collection.

David
 
Oh well,

Thanks a bunch.

David Browne said:
No. The parameters are only plugged in at the server. The best you can do
is output the parameters after the CommandText by iterating the command
parameters collection.

David
 
Back
Top