Group: microsoft.public.dotnet.framework
From: =?Utf-8?B?TWlrZQ==?=
Date: Thursday, November 15, 2007 10:28 PM
Subject: Determine the closest numbers to a specified number

Hi. I have a datatable containing a column named 'Price'. The datatable is
populated with records of varying prices ($1 - $50,000). How can I select
one record from this datatable, and then determine the 5 rows that are
closest to this record's 'Price' value?

For example - Let's say the following items are rows from this datatable.
The value shown is the 'Price' column's value for each respective row. How
could I progamatically say "Give me the 5 closest rows to row# 2's value
(10), and in return receive 7, 20, 100, 1000, 2000?

- 7
- 10
- 20
- 100
- 1000
- 2000
- 3000
- 4000
- 5000
- 6000
- 7000

Thanks