473,320 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DataTable or ArrayList

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
Nov 3 '07 #1
4 3202
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.

On Fri, 2 Nov 2007 22:04:51 -0500, "StinkyDuck" <st********@gmail.com>
wrote:
>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
Nov 3 '07 #2
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

Nov 3 '07 #3
StinkyDuck wrote:
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.

--
Göran Andersson
_____
http://www.guffa.com
Nov 3 '07 #4
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
"StinkyDuck" <st********@gmail.comwrote in message
news:O$****************@TK2MSFTNGP03.phx.gbl...
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

Nov 4 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: mtnhan | last post by:
Hi everybody. I have a plain text file and I read row by row after that put it into datatable (one cell contains one character). So this Datatable size can be 50,000x50,000 or more than. After...
1
by: George | last post by:
I am wondering what is the cost of using DataTable. Lets say i have 1000 Employee records. The object oriented purist will require the Data Layer to return an ArrayList with 1000 Employee objects....
6
by: gane kol | last post by:
Hi, I have a code that creates a datatable from an arraylist, but i am getting an error in casting in for (int intRow = 0; intRow < alLCPlist.Count; intRow++) { DataRow drow =...
2
by: Steve | last post by:
I have a very simple datatable of 1 column which I retrieve from a database, call it 'data'. Dim data As Data.DataTable data = myobject.mymethod(parameter) I want to now turn this 'data' into...
3
by: David | last post by:
Hi all, I am following this code... http://www.devarticles.com/c/a/C-Sharp/Interface-IEnumerable-and-IEnumerator-in-C-sharp/2/ I have come to the part with public Customers(). I am assuming...
15
by: =?Utf-8?B?cm9nZXJfMjc=?= | last post by:
hey, I have a datatable here, but I need to make it into a string array. how do I do that?
0
by: Anish G | last post by:
Hi, I have an issue with reading CSV files. I am to reading CSV file and putting it in a Datatable in C#. I am using a regular expression to read the values. Below is the code. Now, it reads...
4
by: =?Utf-8?B?YmFzdWxhc3o=?= | last post by:
Hi; I want to store a datatable (or an arraylist) as a session variable but when I try; Session = al_RecNo; I get an error that; "Cannot implicitly convert type...
2
by: Mr. Arnold | last post by:
I am working a C# project that uses what's in the subject. I kind of have the basics down on reading the table data. I don't use the above methods of data access or persistence, but I am stuck...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.