HighDots Forums  

Why will this While loop not work

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Why will this While loop not work in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
George Mizzell
 
Posts: n/a

Default Why will this While loop not work - 07-15-2003 , 03:28 AM






I am trying to execute this and I have found that all examples of the While
statement work exactly this way. Why won't it work for me?

<%
Dim MailList
Dim Numb_of_Raters
Dim MailList__numRows

Set MailList = Server.CreateObject("ADODB.Recordset")
MailList.ActiveConnection = MM_websurveys_STRING
MailList.Source = "SELECT supervisor, rater, rater_email, Supv_Code FROM
Non_Covered_Data WHERE Supv_Code='" + Replace(MailList__Supv, "'", "''") +
"'"
MailList.CursorType = 0
MailList.CursorLocation = 2
MailList.LockType = 1
MailList.Open()
%>
<%
Do While Not MailList.EOF
Numb_of_Raters=Numb_of_Raters+1
MailList.MoveNext
Loop
%>

All I am trying ot do is step through the recordset and count the number of
records. However there is something that totally eludes me as to why this
will not work.

Thanks
George



Reply With Quote
  #2  
Old   
Ron
 
Posts: n/a

Default Re: Why will this While loop not work - 07-15-2003 , 04:07 AM






You trying to get a record count? Set the CursorLocation to 3 (I said to set
it to 2 in an earlier post which is wrong). Anyways, I always use While -
Wend for loops:

While Not rs.EOF
....
Wend

--
Ron



Reply With Quote
  #3  
Old   
George Mizzell
 
Posts: n/a

Default Re: Why will this While loop not work - 07-15-2003 , 09:36 AM



Ron

I found one reference site on the web that said While - Wend had been
deprecated and encouraged using Do - Loop instead.

Yes I am tryin gto get a record count which can vary from 1 to 50 records.
Could you see anything else wrong in that code as to why it generates the
ever helpful error message - 500 - Server error.

Thanks
George

"Ron" <ron0079 (AT) spamaol (DOT) com> wrote

Quote:
You trying to get a record count? Set the CursorLocation to 3 (I said to
set
it to 2 in an earlier post which is wrong). Anyways, I always use While -
Wend for loops:

While Not rs.EOF
....
Wend

--
Ron





Reply With Quote
  #4  
Old   
George Mizzell
 
Posts: n/a

Default Re: Why will this While loop not work - 07-15-2003 , 09:47 AM



Ron

By the way, how do I set the cursor to 3?

The loop I posted works if I take out the MoveNext command, but it creates
the fabled - endless do loop, but it doesn't crash. I know it is in the
record movement somehow.

Thanks
George


"Ron" <ron0079 (AT) spamaol (DOT) com> wrote

Quote:
You trying to get a record count? Set the CursorLocation to 3 (I said to
set
it to 2 in an earlier post which is wrong). Anyways, I always use While -
Wend for loops:

While Not rs.EOF
....
Wend

--
Ron





Reply With Quote
  #5  
Old   
Gary White
 
Posts: n/a

Default Re: Why will this While loop not work - 07-15-2003 , 11:05 AM



On Tue, 15 Jul 2003 08:36:38 -0500, "George Mizzell"
<george (AT) engconcepts (DOT) net> wrote:

Quote:
Yes I am tryin gto get a record count which can vary from 1 to 50 records.
Could you see anything else wrong in that code as to why it generates the
ever helpful error message - 500 - Server error.
Just curious why you don't use RecordsetName.RecordCount ?


Gary


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.