Environment: Visual Studio 2008 SP1 and SQL Server 2008
I have a web page that displays a single record from my sql server database. There is a lot of dynamic stuff going on so about hundred methods are called and 100+ sql server transactions. And I am the lucky one who gets to debug it.
So I don’t know really where to start but I figured it would be nice if I can set a break point on each transaction I see in the sql profiler and be able to trace back to code where it came from. Just a thought.
Can you offer any ideas on how you would approach such a feat?
Typically you can break at some high-level point in C# and step forward bit by bit until you get to the SQL generation/execution part. If your problem is on the C# side you can debug that way. If not, step to just before the first SQL execution, fire up the SQL Server admin tool, turn on the SQL profiler and set to to record, then step over the C# side of the SQL execution. Stop the SQL profiler and locate the generated SQL query; you can now copy this out and (1) examine it, (2) run it manually to observe and profile the results.
Do this for each individual SQL statement or each related batch.
It would really help if you had a more specific idea of where it goes wrong or why.