tags:

views:

18

answers:

1

I am using Asp scripting lang, I want to disaply top ten records from a csv file. How is it possible?? Thanks in advance for any help

+1  A: 

While looping through the CSV file, you could create a variable and increment it with each iteration and once it reaches 10, you exit out of the loop:

PHP Example

$counter = 0;

foreach($csv as $line)
{
  $counter++;

  // your code........

  if ($counter === 10) break;
}

ASP Example

Dim Counter
Counter = 0
For Each line In csv
  Counter = Counter + 1

  ' your code

  If Counter = 10 Exit For
Next
Sarfraz
huh.. I mean to say, i want to get details of 10 students who are scoring highest marks from csv file
Parag Redkar