UnitStack
UnitStack

Reputation: 1185

MiniProfiler - SqlParameter

I am using the latest version of the MiniProfiler, everything is setup and working as I would expect. My only issue is that SqlParameters are not being displayed.

For example, I am running a stored procedure:-

var cmd = dbcon.CreateCommand();
cmd.CommandText = "USP_Admin_Subscription_List";
cmd.CommandType = CommandType.StoredProcedure;

// parameters
cmd.Parameters.Add(new SqlParameter("@UserRef", SqlDbType.NVarChar) { Value = customerRef });

When this executes I see the SQL in the MiniProfiler display but I do not see the Parameter @UserRef nor it's value.

Is this possible? It would be great to see the value so I can ensure the correct value is being passed.

I am using MVC 3

Any advice would be welcomed.

Cheers,

J

Upvotes: 6

Views: 985

Answers (1)

Bigwave
Bigwave

Reputation: 2206

Old questions, but just in case anyone else is looking for the answer to this:

The sample code has:

    // different RDBMS have different ways of declaring sql parameters - SQLite can understand inline sql parameters just fine
    // by default, sql parameters won't be displayed
    MiniProfiler.Settings.SqlFormatter = new StackExchange.Profiling.SqlFormatters.InlineFormatter();

You need to change it to:

MiniProfiler.Settings.SqlFormatter = new StackExchange.Profiling.SqlFormatters.SqlServerFormatter();

And your parameters will appear.

Upvotes: 6

Related Questions