473,399 Members | 2,278 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,399 software developers and data experts.

What's the best performatic collection?

Hey guys.

I'm using a DataView to store a lot (amoung 2000 lines) of configuration and
objects and this DataView is indexed by two columns.

That 2000 lines are created in a loop, with the DataView already indexed to
improve search, because I need to check if the record already exists before
create a new. The problem I noticed is this is too low to store new data,
perhaps because the index engine is not optimized for that kind of use.

My questions are:

1. is DataView really not good for that?
2. What the best collection or something I can use to do that job?
Cesar


Nov 21 '05 #1
3 1105
Hi,

When you add a primary key to a datatable you can specify more
than one column. If you use the 2 columns for the primary key you will get
an error when trying to add a duplicate row. Add the row in a try catch
block. If you get an error you are trying to add a duplicate.

http://msdn.microsoft.com/library/de...rykeytopic.asp

Ken
--------------------
"Cesar Ronchese" <ronchese*smlinfo.com.br> wrote in message
news:us**************@TK2MSFTNGP11.phx.gbl...
Hey guys.

I'm using a DataView to store a lot (amoung 2000 lines) of configuration
and
objects and this DataView is indexed by two columns.

That 2000 lines are created in a loop, with the DataView already indexed
to
improve search, because I need to check if the record already exists
before
create a new. The problem I noticed is this is too low to store new data,
perhaps because the index engine is not optimized for that kind of use.

My questions are:

1. is DataView really not good for that?
2. What the best collection or something I can use to do that job?
Cesar

Nov 21 '05 #2
Thanks for reply, Ken.

I would like not use the Try Catch, because it seems be a bit slow (the
first time is called, at least).

I've changed everything to a ArrayList collection and stored others arrays
in each item of the arraylist (and concatened that two IDs into one string).

The performance now turn terrific faster, but I don't know if is the best
form yet.

[]s
Cesar

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:Os****************@TK2MSFTNGP12.phx.gbl...
Hi,

When you add a primary key to a datatable you can specify more
than one column. If you use the 2 columns for the primary key you will get
an error when trying to add a duplicate row. Add the row in a try catch
block. If you get an error you are trying to add a duplicate.

http://msdn.microsoft.com/library/de...rykeytopic.asp

Ken
--------------------
"Cesar Ronchese" <ronchese*smlinfo.com.br> wrote in message
news:us**************@TK2MSFTNGP11.phx.gbl...
Hey guys.

I'm using a DataView to store a lot (amoung 2000 lines) of configuration
and
objects and this DataView is indexed by two columns.

That 2000 lines are created in a loop, with the DataView already indexed
to
improve search, because I need to check if the record already exists
before
create a new. The problem I noticed is this is too low to store new data,
perhaps because the index engine is not optimized for that kind of use.

My questions are:

1. is DataView really not good for that?
2. What the best collection or something I can use to do that job?
Cesar


Nov 21 '05 #3
Hi,

I am glad you found a method that works for you. You could also use
the datatable's find method to check for the record instead of catching the
error.

http://msdn.microsoft.com/library/de...ndatatable.asp

Ken
--------------------
"Cesar Ronchese" <ronchese*smlinfo.com.br> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
Thanks for reply, Ken.

I would like not use the Try Catch, because it seems be a bit slow (the
first time is called, at least).

I've changed everything to a ArrayList collection and stored others arrays
in each item of the arraylist (and concatened that two IDs into one
string).

The performance now turn terrific faster, but I don't know if is the best
form yet.

[]s
Cesar

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:Os****************@TK2MSFTNGP12.phx.gbl...
Hi,

When you add a primary key to a datatable you can specify more
than one column. If you use the 2 columns for the primary key you will get
an error when trying to add a duplicate row. Add the row in a try catch
block. If you get an error you are trying to add a duplicate.

http://msdn.microsoft.com/library/de...rykeytopic.asp

Ken
--------------------
"Cesar Ronchese" <ronchese*smlinfo.com.br> wrote in message
news:us**************@TK2MSFTNGP11.phx.gbl...
Hey guys.

I'm using a DataView to store a lot (amoung 2000 lines) of configuration
and
objects and this DataView is indexed by two columns.

That 2000 lines are created in a loop, with the DataView already indexed
to
improve search, because I need to check if the record already exists
before
create a new. The problem I noticed is this is too low to store new data,
perhaps because the index engine is not optimized for that kind of use.

My questions are:

1. is DataView really not good for that?
2. What the best collection or something I can use to do that job?
Cesar


Nov 21 '05 #4

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

Similar topics

9
by: Sasha | last post by:
Hi, I am extending standard IEnumerator, and I was just wondering what is the best way to make enumarator safe? What do I mean by safe? Detect deletes and all... My idea is to have private Guid...
0
by: Sasha | last post by:
Hi everybody, I would like to hear your thoughts on the following problem. We have the following classes. Class Exam int ID* int Version* string Name
3
by: Sasha | last post by:
Hi everybody, I would like to hear your thoughts on the following problem. We have the following classes. Class Exam int ID* int Version* string Name
21
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.