Re: WHILE LOOP NOT WORKING IN INCLUDE ASP FILE - LOOPING FOREVER



Hi Bob,

Thanks a lot for your help.
It worked finally with your help and guidance.

Here is the working code:

<%
QUERY = "SELECT NUM FROM " & TABLESLIDE & " WHERE ZONEID = '" &
ZonesRS("ID") & "' AND DATE_START < GETDATE() AND DATE_STOP > GETDATE() ORDER
BY NUM"
Set TextPageNumRS = ObjConnection.Execute(QUERY,,1)

If Not TextPageNumRS.EOF Then
arData = TextPageNumRS.GetRows()
End If

TextPageNumRS.Close
Set TextPageNumRS=nothing

If isArray(arData) Then
If Ubound(arData,2) > 1 Then
For i = 0 to Ubound(arData,2)
num = arData(0,i)
%>
<a
href="default.asp?lan=<%=LANGUAGE%>&zone=<%=ZonesRS("ZONE")%>&num=<%=num%>"
onFocus="this.blur()">
<%IF num = Number THEN%><font color="red"><%=num%></font></a>
<%ELSE %><%=num%></a>
<%END IF %>
<%
Next
End If
End If
%>

Thanks again.

"Bob Barrows [MVP]" wrote:

simba wrote:
Hi Bob,

here is my new modified code as you suggested:

<%
QUERY = "SELECT Count(*) FROM " & TABLESLIDE & " WHERE ZONEID = '" &

Careful, this is not what I suggested. The Count(*) bit was for rs, not
for TextPageNumRS. My suggestion was for you to use:
QUERY = "SELECT Num FROM ...

ZonesRS("ID") & "' AND DATE_START < " & Date2SQL(Now) & " AND
DATE_STOP > " & Date2SQL(Now) & " ORDER BY NUM"
Set TextPageNumRS = ObjConnection.Execute(QUERY,,1)

If Not TextPageNumRS.EOF Then
arData = TextPageNumRS.GetRows()
End If

TextPageNumRS.Close
Set TextPageNumRS=nothing

If isArray(arData) Then
<snip>
isArray(arData) always come up as False though there are 5 rows.

Any suggestions.

1. Verify that your query string contains the query you expect it to
contain:
response.write "QUERY contains """ & QUERY & """<BR>"
2. Copy the sql statement resulting from this response.write from thhe
browser window into the native query execution tool used for whatever
database you are using and verify that it returns the correct results
using that tool.

PS. instead of concatenating the result of the vbscript Now function
into your sql statement, you should use the date/time function provided
by whatever database you are using. For example, if you are using Jet
(Access), you should change your sql statement to:

QUERY = "SELECT Num FROM " & TABLESLIDE & _
" WHERE ZONEID = '" & ZonesRS("ID") & "' " & _
"AND DATE_START < Now AND " & _
"DATE_STOP > Now ORDER BY NUM"
response.write "QUERY contains """ & QUERY & """<BR>"

If using SQL Server, use the GETDATE() function instead of Now.


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



.