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



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.


.



Relevant Pages

  • Re: Design View
    ... Someone else may be able to provide a suggestion. ... I also checked references and they seemed fine for that database, ... Okay, Bob, the query contains the reserved word DATE as a field name. ... you may be able to get the SQL statement in A2007 opening the ...
    (microsoft.public.access.queries)
  • Re: Design View
    ... I even went so far as to rename, in Table Design, all the fields that had potential conflicts with Access and that did not effect the problem (even using your suggestion with date and dateadd along with the name changes). ... Okay, Bob, the query contains the reserved word DATE as a field name. ... new database has a problem with references. ... you may be able to get the SQL statement in A2007 opening the ...
    (microsoft.public.access.queries)
  • Re: Update query & null values
    ... The criteria field that I mentioned is when you have the query open in ... It would have helped if you had shown us the sql statement. ... Please reply to the newsgroup. ...
    (microsoft.public.access.queries)
  • Re: Count queries -- make zeros show
    ... Create a new query in Design View, ... Paste the sql statement into the window ... Please reply to the newsgroup. ...
    (microsoft.public.access.queries)
  • Re: Duplicate files returned when performing merge with a parameter query
    ... I guess the first question we need to ask is: ... when you view the query result directly ... the SQL statement into your answer, ... This reply is posted in the Newsgroup; ...
    (microsoft.public.word.mailmerge.fields)