Is it possible to see the sql statement after parameters have been replaced?
using(SqlCommand cmdInsert = new SqlCommand("INSERT INTO Table(Value_fkey) VALUES(@ValueKey)", Database.Connection))
{
cmdInsert.Parameters.AddWithValue("@ValueKey", ValueKey);
System.Convert.ToInt32(cmdInsert.ExecuteScalar());
}
I'd like it to log my sql statements, so rather not via SQL Server, but I don't mind whether it is before, or after calling the statement.