How to view a parameterized query in asp.net?

David H

New member
This should be simple, however, I can't seem to find the answer.

Assume the following code:

strQ = "SELECT location_id, city FROM locations WHERE country = @country ORDER BY city"
Dim cmd As New SqlCommand(strQ, objConn)
cmd.Parameters.AddWithValue("@country", country)

I want to be able to view the query (strQ) as it is passed to SQL Server. If I do a simple Response.Write(strQ) of cours I get a print out of the query before asp.net has applied the parameter commands.

Basically, I have the same question this guy does:

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_22045250.html

Unfortunately, I have no access to experts-exchange so I can't see the answer.

Thanks for any help
 
Back
Top