Possible Duplicate:
How to get the generated SQL-Statement from a SqlCommand-Object?
I would like to know how to retrieve the SQL query that was executed by a Table Adapter for logging purposes.
For example:
Input:
RandomTableAdapter tableAdapter = new RandomTableAdapter();
tableAdapter.Insert("val","val","val","val");
Output:
What I would like to log is the insert statement, which is generated by the table adapter in order to execute the insert command.
Insert INTO RandomTable VALUES ('val', 'val', 'val', 'val');
How can I do this? Does anyone have any suggestions regarding this?