开发者

retrieving top ten records from csv file using asp/php/asp.net

I am using Asp scripting lang, I want to disaply top ten r开发者_如何学JAVAecords from a csv file. How is it possible?


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜