Hi there. I have the following code:
Using cmd As SqlCommand = Connection.CreateCommand
cmd.CommandText = "UPDATE someTable SET Value = @Value"
cmd.CommandText &= " WHERE Id = @Id"
cmd.Parameters.AddWithValue("@Id", 1234)
cmd.Parameters.AddWithValue("@Value", "myValue")
cmd.ExecuteNonQuery
End Using
I wonder if there is any way to get the final SQL-Statment as a String, which should look ike this:
UPDATE someTable SET Value = "myValue" WHERE Id = 1234
If anyone wonders why I would do this:
- for logging (failed) statments
- for having the possibility to copy & paste it to the Enterprise Manager for testing purposes
Thanks and have a nice day.