Looping through record set problem??

# Thread: Looping through record set problem??

1. Mike VB Guest

## Looping through record set problem??

Hi<BR><BR>I&#039;m outputting the results of a recordset into a table. One of the columns is called price <BR>and depending on what this price is I would like another column (score) to display a dependant value.<BR>I can&#039;t get the right results. Cany anyone see where I&#039;m going wrong???<BR><BR>Thanks<BR><BR>MikeVB<BR><BR>&#060; % Do While Not rsProjector.EOF <BR><BR>If rsProjector("PointPrice") = 3000 then<BR>Score = 3<BR>ElseIf rsProjector("PointPrice") = 2800 then<BR>Score = 2<BR>ElseIf rsProjector("PointPrice") = 2500 then<BR>Score = 1<BR>End If<BR>%&#062;<BR>&#060;tr&#062;<BR> &#060;td&#062;&#060;%=score%&#062;&#060;/td&#062;<BR> &#060;td&#062;&#060;%=rsProjector("Resolution")%&# 062;&#060;/td&#062;<BR> &#060;td&#062;&#060;%=rsProjector("Weight")%&#062; &#060;/td&#062;<BR> &#060;td&#062;&#060;%=rsProjector("ProjectorPointP rice")%&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR><BR>&#060;% <BR><BR>rsProjector.MoveNext<BR><BR>Loop<BR><BR>%& #062;<BR>

2. ummmmmm Guest

## RE: Looping through record set problem??

My first guess is that rsProjector("PointPrice") may be a text or currency field? You may want to try this:<BR><BR>intPrice = cint(rsProjector("PointPrice"))<BR>if intPrice &gt;= 3000 then<BR>&nbsp;&nbsp;&nbsp;&nbsp;Score = 3<BR>elseif intPrice &gt;= 2800 then<BR>&nbsp;&nbsp;&nbsp;&nbsp;Score = 2<BR>elseif intPrice &gt;= 2500 then<BR>&nbsp;&nbsp;&nbsp;&nbsp;Score = 1<BR>else<BR>&nbsp;&nbsp;&nbsp;&nbsp;Score = 0<BR>end if<BR><BR>(I added the &gt;, you may not actually want that)

3. MikeVB Guest

## RE: Looping through record set problem??

It works if I put......<BR><BR>if intPrice &#062;="3000"<BR><BR>but I need........<BR><BR>if intPrice &#062;= request.Form("price")<BR><BR>Any ideas to make the 3000 from a form field appear as "3000" in script<BR><BR>Thanks for the help<BR><BR>MikeVB<BR><BR>P.S. what does cint do?

4. ummmmmm Guest

## RE: Looping through record set problem??

use the cint() function. To find out what cint() does (and the magic of the rest of the language that you may be missing) simply read the manual. There&#039;s a link for it on the left hand side of this page under "Reference:"

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•