Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Loop Error

Author  Topic 

Incognito
Starting Member

49 Posts

Posted - 2002-03-21 : 06:35:22
Hello,

I need some advice for a loop: (getting a error message)
This is the code:(using ASP and SQL server 2000)

<%
If RsContactMailing.EOF Then
DIM Waarde
Waarde = 0
While (((rsMilingen.Fields.Item("MailingID").Value) <> (rsContactMailing.Fields.Item("MailingID").Value)) AND (NOT RsContactMailing.EOF))
If (rsMilingen.Fields.Item("MailingID").Value) = (rsContactMailing.Fields.Item("MailingID").Value) Then
Waarde = 1
End If
rsContactMailing.MoveNext()
Wend
If waarde = 1 Then
Response.write "CHECKED"
End If
Else
Response.write ""
End If
%>>

The error is =
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

I'm sure there is data in the table.
What the ****** am I doing wrong(Excusez moi).

Thnx for all the help,

GIA

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-03-21 : 08:50:08
was this a typo?

quote:

<%
If RsContactMailing.EOF Then



because it looks like you want to say
If not RsContactMailing.EOF Then


setBasedIsTheTruepath
<O>
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-03-21 : 08:51:25
Well, your IF statement:

If RsContactMailing.EOF Then
...


Will only run the code when it's reached the end of the recordset, so:

rsContactMailing.MoveNext()

will throw the exact error you're getting.

Snipers! Get your head down!

Edited by - robvolk on 03/21/2002 08:52:16
Go to Top of Page

Incognito
Starting Member

49 Posts

Posted - 2002-03-21 : 09:33:16
I changed my code:

<%
DIM Waarde
Waarde = 0
While (NOT RsContactMailing.EOF)
If (rsMilingen.Fields.Item("MailingID").Value) = (rsContactMailing.Fields.Item("MailingID").Value) Then
Waarde = 1
End If
rsContactMailing.MoveNext()
Wend
If waarde = 1 Then
Response.write "CHECKED"
Else
Response.write("")
End If
%>
>
It still returns the same error.

Go to Top of Page
   

- Advertisement -