[thelist] ASP/SQL DONE DEAL! Follow up, by request...
J. Blanchard
jay.blanchard at thermon.com
Mon Sep 17 10:08:10 CDT 2001
Matt warden created the final code as follows...
<%
DIM pd
pd = ""
While Not product.EOF
If pd <> (product.Fields.Item("ProductDesc").Value) Then
pd = (product.Fields.Item("ProductDesc").Value)
response.write (pd & "<br>")
End If
response.write((product.Fields.Item("ProductID").Value) & "<br>")
product.MoveNext
Wend
%>
The problem was that I had one too many MoveNext's and my test for equality was in the write spot, but ended in the wrong one.
Line 1. Dim the variable for equality test
Line 2. Set variable default value
Line 3. While the recordset is not at End of File
Line 4. If the variable is NOT = to the product description
Line 5. Set the variable = to product description
Line 6. Write the product description
Line 7. End test
Line 8. Write out the first product id for this product description
Line 9. Move to the next record in the set which sends you back to the if statement in line 4. If they are equal this ends the IF and then writes the next product id.
Line 10. End the while loop.
Thanks!
Jay
___________________________________________________________________________
Visit http://www.visto.com.
Find out how companies are linking mobile users to the
enterprise with Visto.
More information about the thelist
mailing list