DataTable or ArrayList

  • Thread starter Thread starter StinkyDuck
  • Start date Start date
S

StinkyDuck

I'm trying to determine which type of collection to use, DataTable or
ArrayList. I understand that an ArrayList can be linked to databound
objects if it contains the IList interface.

Is there a recommendation to use one over the other. If you are not going
to bind the collection to any objects should an ArrayList be used? Is there
a benefit on size? If I have a 200,000 rows of data, should a DataTable be
used in this case?

Any information or experiences would be greatful.

-StinkyDuck
 
I'm sure others will have different opinions, but my preference is to:

Use ArrayList for collections that are not data bound and which are
not used to update a database.

Use BindingList(Of T) for collections that are data bound. BindingList
doesn't do sorting or searching by default, but it is not difficult to
subclass it to add those features.

Use DataSet / DataTable for collections that are fetched from a
database, modified, and then used to update the database. I wouldn't
use DataSet / DataTable for large amounts of data.
 
Hi,

If you use VB 200/2003, then you can use an own class build with collection
base.

Otherwise are generics the way to go for this amounts of rows of data in
memory.

http://msdn2.microsoft.com/en-us/library/ms172192.aspx

However what you want to do with 200.000 rows of data in memory. Try to
leave as much as possible on your server, it will cost you a lot of time to
load.

The raw arraylist is only fine with only one field, by instance strings.

Cor
 
StinkyDuck said:
I'm trying to determine which type of collection to use, DataTable or
ArrayList. I understand that an ArrayList can be linked to databound
objects if it contains the IList interface.

Is there a recommendation to use one over the other. If you are not going
to bind the collection to any objects should an ArrayList be used? Is there
a benefit on size? If I have a 200,000 rows of data, should a DataTable be
used in this case?

Any information or experiences would be greatful.

First of all you should look at how to elliminate the amount of data.
You should fetch only the data that you actually use. You are never
going to show 200,000 items simultaneously, as they simply doesn't fit
on the screen. If you ever show more than a few hundred items, there is
something wrong with your user interface.

After that, it's more a matter of taste.
 
This is getting interesting. Let me explain what I'm trying to accomplish
and maybe you guys can provide your ideas. I'm trying to pull out data from
a 3rd party application which provides an API. The primary communcation
with the API are with XML messages. What I'm trying to do is query the 3rd
party database via the API where I get XML response messages. I pull out
the pertinent data from the XML file(s) and store it in memory. I have 5 or
6 memory tables which I need to perform some cross referencing to get to the
data that I actually need. I then take the aggregated data and build an
Excel spreadsheet to persist the data there.

I would be interested to know how someone else would handle this situation.
So basically I have XML files that contain 100 to 200,000 rows of
information. Walking through each XML file do I store the data in an
ArrayList or DataTable? I don't have to update the DataTable/ArrayList. I
just have to search through it to pull out and run some calculations from
each list.

-StinkyDuck
 
Hi,


Please help me.

I'm developing Window application.

I've a Dataset which contains 2 fields(codval,coddsc).I need to put "codval" field values in to Arraylist.

I can put "foreach" loop.But if that dataset contain more than 1,00,000 records this will reduce the performance.

Is there any other way to solve this problem.......?

Please help me....


Thanks in Advance.



With Regards
Srikanta
 
Back
Top