Tuesday, July 30, 2013

How can I debug a parameterized query?



<<<<<<<<<<<<<<<<Here is one weird way to pass information to an area you normally don't see but I've done it as a last resort and have found what I was looking for.

public OracleDataReader ExecuteParamReader(string sql, string sParam1, string sParam2, string sParam3)
{
<<<<<<<<<<<<<<<<<Do some variable in this scope
try
{
<<<<<<<<<<<<<<<<<<<,,In here set those out of scope variable with info...
OracleDataReader reader;
OracleCommand cmd = new OracleCommand(sql, conn);
cmd
.Parameters.Add("sParam1", OracleDbType.Varchar2).Value = sParam1;

When in your catch area If you don't see those variables in the Locals tab type the variable names in the Watch tab.

No comments:

Post a Comment