473,320 Members | 1,922 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.

Finding if a column is unique in a dataset

I have a dataset that has megs of data. I want to know if there is a
way to find out if data in a particular column is unique or not. Does
the dataset or a datatable have a built in function that i can use?

Thanks

Mar 9 '06 #1
4 1555
DataColumn.Unique

But it is only going to be set to Unique if you have set it that way,
or if it was auto-generated that way in your dataset schema.
How are you filling your dataset, and is it strongly typed?

Mar 10 '06 #2
Thanks. No, the dataset is not strongly typed and I am filling the
dataset from a datasource and I am not sure if this datasource has any
unique constraints on the data.

Mar 10 '06 #3
Ok, I am doing this:

bool isUnique = data.Tables["Item"].Columns["Number"].Unique;

Now, if isUnique is false, is there a way to find out the value of the
item that's duplicate?

Mar 10 '06 #4
ok. Yeah you would need to loop through and check for duplicates.
A loop inside a loop would be the quickest and easiest way, but
depending how many rows you have, not that effecient.

Mar 12 '06 #5

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

Similar topics

1
by: Dan | last post by:
I have a dataset with stock info Date, Open, Hi, Low, Close. How do I determine the Max value of one column? How do I determine the max value of all columns? Thanks in advance - Dan
3
by: Wilson Wu | last post by:
Hi, How can I find the field value in the dataset and then assign one of the field value to a variable ? Thanks Wilson
6
by: Alpha | last post by:
I retrieve a table with only 2 columns. One is a auto-generated primary key column and the 2nd is a string. When I add a new row to the dataset to be updated back to the database. What should I...
16
by: Geoff Jones | last post by:
Hi Can anybody help me with the following, hopefully simple, question? I have a table which I've connected to a dataset. I wish to add a new column to the beginning of the table and to fill...
9
by: dave m | last post by:
I need to be able to retrieve a unique ID from a users PC. I needs to be something a user could not easily change, like the computer name. Could someone point me in the right direction to find ...
3
by: DavidB | last post by:
New to .net....sorry if this seems repetitive I have a dataset ordered by date (SQLDataAdapter SelectCommand uses Order By) and want to find a record by a UniqueID(Identity Column). Then I want...
0
by: GS | last post by:
I am not getting any row with this Function getPaternByKeys(ByVal codeValue As String) As String ' actually column can be identified either by number or its name Const MyCodeTblkey As String =...
12
by: JMO | last post by:
I can import a csv file with no problem. I can also add columns to the datagrid upon import. I want to be able to start importing at the 3rd row. This will pick up the headers necessary for the...
4
by: jameswilkinsonfjs | last post by:
Hi All, Ok I have a table - it lists items with a unique reference code; lets say there are 4 items : Item RefCode 1 ABC1 2 ABC2 3 ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: 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)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.