|
When your projects do not work as expected, especially when you use a
load of events and custom code, you can use the following debugging
techniques to resolve the issue.
1. Print all executed SQL statements on the Web page
For this purpose set dDebug
variable in include/dbcommon.asp
file to True. Especially
useful when you need to resolve master-details or advanced security issues.
You can copy SQL query and run it against your database manually to
see if it returns correct results. To run SQL query manually use
tools that comes with your database (Query designer in MS Access,
Enterprise Manager in SQL Server, phpMyAdmin in MySQL).
2. Print out variables using Response.Write
The response.write command is used to write output to a browser. The
following example sends the text "Hello World" to the browser:
Response.write "Hello World"
Here are several examples of how you can use Response.Write
Response.Write "Variable name: "
& variable
Response.Write "field_name: "
& dict("field_name")
Response.Write "UserID: " & Session("UserID")
Response.Write "Your IP address: "
& Request.ServerVariables("remote_addr")
Keep in mind that sometimes the response.write command may appear not
to work, nothing is displayed on the page. In this case you can send
buffered HTML output to the browser immediately:
Response.Write variable_name
Response.Flush
|