Good way to do lookups

  • Thread starter Thread starter BobRoyAce
  • Start date Start date
B

BobRoyAce

I want to have a a set of "records" (i.e. would have used a Recordset
in the VB6 world) that contains a list of say 500 short string values
to lookup and then 500 short strings to replace them with when found.
What I'm going to use this record set for is to lookup the parts of a
street address and replace them with standard abbreviations. What I
could use guidance with is the best object to use for this record set
which will be used for lookups.
 
BobRoyAce,

One option is to use a Hashtable. One list of strings would be the keys and
the other list of strings would be the values.

Kerry Moorman
 
Thanks Kerry. But, wouldn't that solution require using something to
read in the data from the database and populate the HashTable which I
could then use? Is there not something (DataTable or something) that I
could use to just read in the data and then use it (like I used to use
Recordsets in the past)?
 
BobRoyAce,

Another option would be to fill a datatable with the data from the database
and then use the datatable's Select method to locate the appropriate datarow,
based on a filter expression.

Kerry Moorman
 
Thanks Kerry...that's what I thought. For now, I've decided to go with
a Hashtable that I populate using a DataReader and that seems to be
working just fine.
 
Back
Top