What SQL is being sent from a SqlCommand object

Posted by Justin808 on Stack Overflow See other posts from Stack Overflow or by Justin808
Published on 2010-04-09T22:46:07Z Indexed on 2010/04/09 22:53 UTC
Read the original article Hit count: 266

Filed under:
|
|
|

I have a SqlCommand object on my c# based asp.net page. The SQL and the passed parameters are working the majority of the time. I have one case that is not working, I get the following error:

String or binary data would be truncated. The statement has been terminated.

I understand the error and but all the columns in the database should be long enough to hold everything being sent.

My questions,

Is there a way to see what the actual SQL being sent to the database is from SqlCommand object? I would like to be able to email the SQL when an error occurs.

Thanks, Justin

© Stack Overflow or respective owner

Related posts about c#

Related posts about sqlcommand