<gf****@yahoo.com> wrote in message
news:11*********************@e56g2000cwe.googlegro ups.com...
Hi,
I need to know how to retrieve many records from an access datafile,
one by one.
Let me explain you.
I have an array with 2 column by 1000 rows, in one column I have part
code, the other is for the cost that I have to search in a Access file.
I have to make one Select command with XXX Part code, retrieve the
cost, and then again to make another Select command with YYY Part code,
retrieve the cost, so on, for 1000 records.
How to make it? What is the best way to do it?
TIA
Are you saying that you will need to retrieve the cost for all 1000 items
each time you use the array, or that you need to randomly retrieve cost for
individual parts as your program is used?
As 1000 entries is not a lot, as lookup tables go, there are several
options.
The suggestions below assume you are using the described Access table as a
lookup table.
You could create a datatable in a dataset from the Access table, then use
parameterized commands to retrieve individual part costs, using the part
code as the parameter.
You could also retrieve the data from the Access table using a DataReader,
then use the DataReader.Read() method to populate an appropriate data
structure with the lookup information as key - data pairs. Assuming you part
codes are unique, the sorted list should work.