I like everything you are doing except for the displaying all query information via the querystring parameter. I would suggest that feature only be available in debug mode on a dev. server or something of that nature. It could otherwise pose a large security risk.
I also see in that query you posted (line third from the bottom) ends in
where <some field> = 582
It would be a good idea to use parameterized queries instead of string concatenations. It leaves you open for a slew of nasty problems like slower performance and sql-injection attacks. If you use parameterized queries, that would go away.
Hope I added some value to your "standard".
Best of luck.