Is there an easy way to get the actual SQL query that is sent from a parametrized CommandText?
If I have
mySQLCommand.CommandText = ("UPDATE dbo.Users SET LimitTime=@limitTime WHERE userID=@userID");
how can I save that to a string with the values of limitTime and userID? I need to be able to log the actual SQL sent.
I have tried to do a mySQLCommand.CommandText.toString() but that does not fill in the values.
EDIT: sorry, this is not mySQL, it is for SQL Server. mySQLCommand is just what I called the SqlCommand variable. Did not even think that is could be confusing.
"UPDATE dbo.Users SET LimitTime=@limitTime WHERE userID=@userID". I assume MySQL is similar to SQL Server in this respect. Basically the parameters are not spliced into the query, they are sent in binary alongside the query, not as part of it. I doubt there is a way to produce an equivalent SQL query built into the library..ToString()part ofCommandText.ToString()is redundant becauseCommandTextis astring.