Is there a straight forward way to view the SQL command text actually executed against the underlying database by a DbCommand object (i.e. after the parameters have been processed into a statement)?
Here the detail: I'm using VB.Net 3.5 and have a factory object (DbProviderFactory) and a connection (System.Data.IDbConnection). I am using the factory to create a new command object using the DbProviderFactory.CreateCommand() method and then assigning a parametrized query to the CommandText property of the command. Later on I create and associate some parameters with the query (created using the DbProviderFactory).
This is great, but I want to get a look at the actual SQL statement generated by the command object. I am currently testing this against a SQLite database, but wondered if there were a general approach which would work.