Resulting CommandText when using Parameters
Posted: Wed 24 Oct 2012 09:44
Hi folks,
I hope you can help me with my little question I have: I want to be able to log the resulting command text in certain cases when using Parameters in my MySQL query.
Let's say I use something like:
I now want to get the resulting query to write it into my logs if it fails like:
Query Failed: INSERT (field1, field2) VALUES (2013-10-24, 01230) INTO mytable
Is this possible? If so: how?
Thanks in advance,
Bernhard
I hope you can help me with my little question I have: I want to be able to log the resulting command text in certain cases when using Parameters in my MySQL query.
Let's say I use something like:
Code: Select all
c.CommandText = "INSERT (field1,field2) VALUES (:p1. :p2) INTO mytable";
c.Parameters.Add(":p1", DateTime.Now);
c.Parameters.Add(":p2", someObject.Foobar);Query Failed: INSERT (field1, field2) VALUES (2013-10-24, 01230) INTO mytable
Is this possible? If so: how?
Thanks in advance,
Bernhard