Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Using the Trace funtionality

Status
Not open for further replies.

putrtek

Programmer
May 18, 2003
49
US
This is probally a pretty simple fix but I can't seem to find an answer anywhere. I have page level Trace enabled and I'm trying to Display SQL sttaement that is passed to my SQL database durin a Update.

The Following code:

Trace.Write("SQL Stmt", SqlDataSource1.UpdateCommand)

returns

UPDATE [HazConType] SET [HazConType] = @HazConType WHERE [HazConTypeID] = @HazConTypeID

in the Trace Information section.

What I would like returned is the Actual values that are being passed for '@HazConType' and '@HazConTypeID'.

Does anyone know how to do this? Appreciate any assisatnce.

Thanks in Advance,

-MARK-


Mark Buckley
 
You can use SQL Profiler to see the acutal values. In VS I think you will have to find where the values are being assigned to the values. If it is a bulk update, like from a grid, then use SQL Profiler.
 
Thanks for the response.

This is not a bulk update... just updateing one record at a time... I'm just trying to figure out how to show the values of the SQL parameters that are being passed...

Mark Buckley
 
Look in the locals window of visual studio while stepping through debug mode.
 
Update is being done via a inline update using a Gridview. I'm also using Visual Web Developer and NOT the full blown VS.

-MARK-


Mark Buckley
 
OK, so use either of the two methods that have been suggested to find the values that are/have been submitted.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Thanks for your suggestions... I'm trying to find a way to get this information using the built in Trace feature.

Using the Trace feature you can setup a page such that when needed you can add a Querystring like "?Trace=True" to your URL and it will show you trace information.

You can also display Variables that are on your page using a Trace.Write or Trace.Warn statements.

SO what I would like to see is the actual SQL statement that has been constructed using the UpdateCommand. This can be used for troubleshooting purposes.

Again thanks for your suggestions, but they are not quite what I was looking for. I'll look elsewhere.

-MARK-

Mark Buckley
 
SO what I would like to see is the actual SQL statement that has been constructed using the UpdateCommand. This can be used for troubleshooting purposes.
The actual SQL statement that is constructed doesn't get the values embedded into it where you have placed the parameters. The best you will be able to output to the Trace section is the original SQL statement and the variables that you assign to the parameters.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Alternatively, you could construct the SQL statement that should be produced by using the Replace method on the SQL string and replace the parameters with the values you assigned.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
OK That would work... Can you tell me how to write out the values that have been assigned to the Update Parameters... I couldn't find any way to do that..

TIA for your help.

-MARK-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top