title: Get the generated SQL statement from a SqlCommand object?
body: <p>I have the following code:</p>
  
  <pre><code>Using cmd As SqlCommand = Connection.CreateCommand
      cmd.CommandText = "UPDATE someTable SET Value = @Value"
      cmd.CommandText &amp;= " WHERE Id = @Id"
      cmd.Parameters.AddWithValue("@Id", 1234)
      cmd.Parameters.AddWithValue("@Value", "myValue")
      cmd.ExecuteNonQuery
  End Using
  </code></pre>
  
  <p>I wonder if there is any way to get the final SQL statment as a String, which should look like this:</p>
  
  <pre class="lang-sql prettyprint-override"><code>UPDATE someTable SET Value = "myValue" WHERE Id = 1234
  </code></pre>
  
  <p>If anyone wonders why I would do this:</p>
  
  <ul>
  <li>for logging (failed) statements</li>
  <li>for having the possibility to copy &amp; paste it to the Enterprise Manager for testing purposes</li>
  </ul>