473,383 Members | 1,739 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,383 software developers and data experts.

Unique records from DataTable

Hi,

How do i get unique values of a specific column in a DataTable - i dont
surpose i ts possible to use something like "select distinct" as in regular
SQL ??

Soren
Nov 15 '05 #1
3 11220
http://support.microsoft.com/default...b;EN-US;326176
"Soren Staun Jorgensen" <no@spam.com> wrote in message
news:OZ*************@TK2MSFTNGP12.phx.gbl...
Hi,

How do i get unique values of a specific column in a DataTable - i dont
surpose i ts possible to use something like "select distinct" as in regular SQL ??

Soren

Nov 15 '05 #2
unfortunately, you can't do a select distinct. the only alternative
i've seen is to loop through the rows and add the columns value to a
hashtable.

Hashtable ht = new Hashtable();

foreach(DataRow dr in table.Rows)
{
if(!ht.Contains(dr["ColumnName"]))
{
ht.Add(dr["ColumnName"], null);
}
}

On Wed, 11 Feb 2004 21:52:33 +0100, "Soren Staun Jorgensen"
<no@spam.com> wrote:
Hi,

How do i get unique values of a specific column in a DataTable - i dont
surpose i ts possible to use something like "select distinct" as in regular
SQL ??

Soren


Nov 15 '05 #3
Nice, thanks...

Soren

"William Ryan eMVP" <do********@comcast.nospam.net> skrev i en meddelelse
news:e6****************@TK2MSFTNGP10.phx.gbl...
http://support.microsoft.com/default...b;EN-US;326176
"Soren Staun Jorgensen" <no@spam.com> wrote in message
news:OZ*************@TK2MSFTNGP12.phx.gbl...
Hi,

How do i get unique values of a specific column in a DataTable - i dont
surpose i ts possible to use something like "select distinct" as in

regular
SQL ??

Soren


Nov 15 '05 #4

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

Similar topics

3
by: Beat Scheidiger | last post by:
I do not quite understand this property. Everything is seems clear to me, when I read the corresponding help text. But in practice I have a question: Why are there 3 identical records in the...
5
by: Terri | last post by:
I have a form with a multi-select combo. I dynamically build a SELECT statement, open a report, and set the recordsource to my dynamic SELECT statement. I count the records returned in the report...
7
by: Nicolae Fieraru | last post by:
I have two tables, they contain: Table1: ID1, Name1, Address1, Purchase1 Table2: ID2, Name2, Address2, Purchase2 I need a query which creates Table3 with content from Table1 and Table2. The...
4
by: lostpupp | last post by:
Basically I am trying to do a query that returns records where the count value of a sorted list of a column is equal to 1. Ex. Column1 Column2 1 1 7 1 3 ...
4
by: kdubble | last post by:
Hi I am trying to get the results of a query to show only unique student records (not duplicates). Is there a simple way to make the criteria field do this? I am not too familiar with SQL. ...
3
by: IsValidUN | last post by:
How do you select unique records? For example, if my data is like the following and I only want the repeated data (address information) to appear once for each theater_id. <xsl:for-each...
2
by: srusskinyon | last post by:
I need some help getting unique records from our database! I work for a small non-profit homeless shelter. We keep track of guest information as well as what services we have offered for...
2
Zwoker
by: Zwoker | last post by:
Greetings everyone, I have a problem that I hope has a simple solution. I am using MS Access 2003. I have a table that is a list of financial transactions. I am using a make table query over...
10
by: jmartmem | last post by:
Greetings, I have an ASP page with a 5x5 table embedded inside an Insert Record Form. This table contains several fields (mostly drop down list menus) and is used for corporate timekeeping (users...
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.