Can someone see something wrong with this code?

Hi

I have the following code in my app:

[code] sql = “SELECT * FROM classesBackup WHERE specialSelection = 1”
data = checkClasses.SQLSelect(sql)
If checkClasses.Error Then
MsgBox(checkClasses.ErrorMessage)
End If
If data <> Nil Then
While Not data.EOF
recovery.recoverSpecials(data)
data.MoveNext
Wend
data.Close
End If

sql = “SELECT * FROM classesBackup WHERE specialSelection = 0”
data = checkClasses.SQLSelect(sql)
If checkClasses.Error Then
MsgBox(checkClasses.ErrorMessage)
End If
If data <> Nil Then
While Not data.EOF
recovery.recoverClasses(data)
data.MoveNext
Wend
data.Close
End If
[/code]

Except for the WHERE clause the two blocks of code are practically identical, but I am getting an “UnsupportedOperationException” on “data.MoveNext” in the second block. It works fine in the first block. There is a specialSelection field in the database, and the entries are either 0 or 1.

Just added: Mac OSX Yosemite, Xojo 2014 Release 2.1.

Does it still happen if you comment out

recovery.recoverClasses(data)

?

That’s very odd, it doesn’t happen on commenting out that line. However, the code block above has the same line (just a different method in the same module).

Thanks for the quick reply.

Thanks Jeff for the clue. In that call I am cycling through the RecordSet, and then I am doing the same thing when I get to the Module :frowning: . I removed the While … Wend and the data.MoveNext, and it all worked fine. Been working on this program for far too long, I think.

I will try to do the same thing with the previous call to the module.

Thanks again.