Alternatives to DataTable

G

Guadala Harry

The current implementation (that works) retrieves data from a SS2K db via
stored procedure that returns 40-60 rows and 6 columns (one string and five
int columns), and places that result set into a DataTable that remains in
the Application State (this is an asp.net web application). Various methods
throughout the app read this DataTable - searching for one specific row and
then specific column(s) within the found row. While everything works, I'm
looking to verify that I have (1) considered all reasonable alternatives and
(2) implement the solution with fastest expected performance.

Elsewhere in the application, I have implemented ListDictionary and
HashTable collections with great results. Those structures work great for
name/value pairs that can be retrieved based on a single key value. But the
result set in question contains 6 columns, and searches for specific rows
are based on 2 or 3 columns (currently accomplished using the DataTable's
Select method). Given the need to find a row based on more than one value, I
can't simply retrieve the desired row based on a single key value like I can
with a hash table.

So, what are my alternatives to the DataTable? Or would you recommend
sticking with it?

Thanks!
 
N

Nicholas Paldino [.NET/C# MVP]

Guadala,

Since the set is small, you might be able to use HashTables to keyed
properly to cover all of your selection criteria, but if you ever needed to
add a column, the unwieldy nature of the solution would make it quite
unmaintainable, IMO. I would recommend sticking with the DataTable, as it
would be easier to maintain in the future, should you have to make changes.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top