Search code examples
c#.netsqlcommandidbcommand

How to obtain the IDbCommand output to the DB? (.NET)


I have a SqlCommand object, and I execute its ExecuteNonQuery method. The query fails, but I can't see how to obtain the query to debug it. Could you help me?

Update I am currently using Wireshark (tcpdump) to read the command, but I think that its not the best solution

Update The CommandText property only provides the Stored Procedure name. I want the whole command, with the parameters.


Solution

  • You can use SQL Profiler to see what is the query/call to stored procedure being sent along with parameterrs.