View exact query executed in ASP page
I've got stored procedures in my ASP code and I'd like to see the full command开发者_Python百科 text (not just the (?,?,?,?) that will execute so I don't have to open up SQL Profiler.
Code is as follows:
sSQL="myProc"
Set dbCommand = Server.CreateObject("ADODB.Command")
Set dbCommand.ActiveConnection = oConn
dbCommand.CommandType = adCmdStoredProc
dbCommand.Commandtext=sSQL
dbCommand.Parameters.Append (dbCommand.CreateParameter("@tutorID", adInteger, adParamInput, 0, sTutorID))
set oRST=dbCommand.Execute
Try reading the value of dbCommand.CommandText
after you set the parameter.
This should give you the full command that will be executed. It won't give you the content of the stored procedure, though.
精彩评论