Marco wrote:
When i try to execute this cycle:
<%while not (oRS("IDFoto")=IDFoto)
IDPrec=oRS("IDFoto")
oRS.MoveNext
wend%>
i get the error:
80020009 Exception Occurred
I want to select the record with the field IDFOTO= the value in the
variable IDFoto
I'm sure the cycle doesn't work, if i modify it so:
while (oRS("IDFoto")=IDFoto)
it works (but with no right result of course)
Does anyone can help me??
Thanks
Marco
Why are you using a loop to find a record? Finding records is what queries
were designed to do very efficiently. I suggest adding this search criterion
to the query that you use to open the recordset.
If for some reason you need to retrieve records in addition to the records
that meet this search criterion, then use the recordset's Find method to get
the record.
If IDFoto is a text/char field:
oRs.Find "IDFoto='" & IDFoto & "'"
If numeric:
oRs.Find "IDFoto=" & IDFoto
Here is the documentation on the Find method:
http://msdn.microsoft.com/library/en...dmethodado.asp
If there are multiple records that meet the criteria, use the Filter
property instead:
http://msdn.microsoft.com/library/en...asp?frame=true
You will need to use a cursor that supports bookmarks (adOpenStatic) in
order to use these methods.
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"