tags:

views:

402

answers:

1

Using a .NET DbCommand (eg OracleCommand, SqlCommand, ODBCCommand, etc) object with Parameters, how can I get the SQL that will actually be executed - ie with the parameter values filled in? I could certainly write my own search / replace method, but that is incredibly close to just re-writing the logic behind the parameters. (Specifically, I would have to consider the parameter type, parameter names showing up in non-parameter locations, etc). Anyway, I am looking for a built in way to do it if there is one.

+2  A: 

Hi David,

As far as I know what you want is not possible. The query is passed to the database as a parametric query, along with the parameters. So ADO.NET doesn't know the "completed" SQL you are dreaming of.

tekBlues

related questions