我有一些调试消息(通过 Response.Write() 编写),当我像这样(在 VB 代码中)执行“查看源代码”时可以看到:
currentYear = Year(Now)
SQLString = "Select NewBiz from MasterUnitsprojSales where CYear = " & currentYear & " and Unit = '" & Unit & "'"
adoRS = New ADODB.Recordset
adoRS.Open(SQLString, adoCon)
IsNewBusiness = TRUE 'default (if record not found)
Category = "New Business"
If Not adoRS.EOF Then
IsNewBusiness = adoRS.Fields.Item(0).Value <> 0
if Not IsNewBusiness
Category = "Existing Business"
End If
Response.Write("<!-- IsNewBusiness after NOT EOF assignment = " & CStr(IsNewBusiness) & "-->")
End If
adoRS.Close()
-and(在 hmtl 内):
<% Response.Write("<!-- Is New Biz = " & IsNewBusiness & "-->") %>
当我转到页面并“查看源代码”时,我可以看到这些消息
但是我还有其他类似的实例没有被写出来,例如:
If Request.Form.Item("Action") = "Save" Then
Response.Write("<!-- Made it into the Action =Save block -->")
. . .
我知道这个块已经到达,因为其中的逻辑正在发生(数据库插入)。
为什么 Response.Write() 并不总是有效?