I am adding a bit of functionality to the old ("old", as in the "old", as in the Rip-van-Winkle olde) website that uses VBScript.
The result of my problem is that a certain logic is always equated to one result (IsNewBusiness always seems to be assigned the value FALSE), while sometimes this should be reversed: logic
IsNewBusiness = TRUE 'default (if record not found)
If Not adoRS.EOF Then
IsNewBusiness = adoRS.Fields.Item(0).Value <> 0
End If
So, since logic is always equated to false, I have to assume that this line:
IsNewBusiness = adoRS.Fields.Item(0).Value <> 0
... and that adoRS.Fields.Item (0) .Value is always 0
As you can see in the above code, IsNewBusiness Boolean is set to TRUE, but never remains true, although in some cases it should be (reset) equal to TRUE (the result of the query should, parameters, return the value "-1", not 0).
This question is really related to the question I asked here :
So, to understand the essence of the biscuit, I want to make sure that the if block shown above is reached by writing the "debug console" to the console or something like that.
Based on the legacy code on this site, I made an attempt to link javascript to this:
ReturnMsg = "Made it to IsNewBusiness logic"
Response.Write("<script type=""text/javascript"">" & vbCrLf)
Response.Write("alert ('" & ReturnMsg & "');" & vbCrLf)
Response.Write("</script>" & vbCrLf)
... but it doesn't seem to work - I never see this msg.
I also tried this:
Response.Write("window.alert(ReturnMsg);")
... and this:
Response.Write("console.log(ReturnMsg);")
... without any difference in results. All that I see on my console:

"" msg, , VBScript javascript - ?
UPDATE
javascript, :
adoRS.Close()
<script language="javascript">
window.alert("Made it past the IsNewBusiness logic");
</script>
... ...
2
, -, , , .
:
currentYear = Year(Now)
SQLString = "Select NewBiz from MasterUnitsprojSales where CYear = " & currentYear & " and Unit = '" & Unit & "'"
adoRS.Open(SQLString, adoCon)
IsNewBusiness = TRUE 'default (if record not found)
If Not adoRS.EOF Then
IsNewBusiness = adoRS.Fields.Item(0).Value <> 0 'Is this ever reached?
End If
adoRS.Close()
... :
currentYear = Year(Now)
SQLString = "Select NewBiz from MasterUnitsprojSales where CYear = " & currentYear & " and Unit = '" & Unit & "'"
adoRS.Open(SQLString, adoCon)
IsNewBusiness = TRUE 'default (if record not found)
ReturnMsg = "Before the If Not adoRS.EOF block"
Response.Write("<script type=""text/javascript"">" & vbCrLf)
Response.Write("<!--" & vbCrLf)
Response.Write("alert ('" & ReturnMsg & "');" & vbCrLf)
Response.Write("-->" & vbCrLf)
Response.Write("</script>" & vbCrLf)
If Not adoRS.EOF Then
IsNewBusiness = adoRS.Fields.Item(0).Value <> 0 'Is this ever reached?
ReturnMsg = "Entered the If Not adoRS.EOF block"
Response.Write("<script type=""text/javascript"">" & vbCrLf)
Response.Write("<!--" & vbCrLf)
Response.Write("alert ('" & ReturnMsg & "');" & vbCrLf)
Response.Write("-->" & vbCrLf)
Response.Write("</script>" & vbCrLf)
End If
adoRS.Close()
... , , View Source, " If not adoRS.EOF" . ?
3
( , ):
Response.Write("")
If Not adoRS.EOF Then
IsNewBusiness = adoRS.Fields.Item(0).Value <> 0 'Is this ever reached?
Response.Write("")
End If
4
, debug msg, , View Source, javascript, . javascript:
<script language="javascript">
window.alert("Before the If Not adoRS.EOF block js");
</script>
:
Response.Write("")
<script language="javascript">
window.alert("Before the If Not adoRS.EOF block js");
</script>
If Not adoRS.EOF Then
... :
Server Error in '/EMS/customerreportingnet' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30636: '>' expected.
Source Error:
Line 129: IsNewBusiness = TRUE 'default (if record not found)
Line 130: Response.Write("")
Line 131: <script language="javascript">
Line 132: window.alert("Before the If Not adoRS.EOF block js");
Line 133: </script>
Source File: C:\EnhancedMonthlySalesReporting\customerreportingnet\customerreportingnet\pages\custmaint_entry.aspx Line: 131
... :
Line 129: IsNewBusiness = TRUE 'default (if record not found)
Line 130: Response.Write("<!-- Before the If Not adoRS.EOF block -->")
<font color=red>Line 131: <script language="javascript">
</font>Line 132: window.alert("Before the If Not adoRS.EOF block js");
Line 133: </script></pre></code>
... , .