Hi watyeag. Try this:
Dim i
For i = 0 To UBound(array)
Response.Write item
If i>=9 Then Exit For
Next
Main Topics
Browse All TopicsI have an array in ASP created from a recordset using GetRows. The code below shows the entire array on the page. I only want to show the first 10 records of the array. I'm sure that I am missing something very easy and obvious, but for the life of me I cannot find anything via google search that seems to be what I am looking for. How can I make the for loop to only loop 10 times instead for the entire array? Code below:
For Each item In array
Response.Write item
Next
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
>> don't you mean Respoinse.Write array(i)
Yes, sorry about that. How many columns are in you recordset? If 1, "array(i) " is enough
>> Why add the extra line of code to exit?
If you don't exit the loop, it will print whola array. You wanted only 10 items. You could use "For i = 0 To 9", but coe will crash, if there are less than 10 items in array.
Business Accounts
Answer for Membership
by: slightwvPosted on 2009-11-06 at 12:57:58ID: 25762984
Something like:
For i=0 to 9
response.write array(i)
Next