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

Create a DataView of Distinct row from a DadaTable

Hi,

I want to know how to create a dataview from a datatable of DISTINCT data.

Thank in advance
Jan 26 '06 #1
3 4350
DataView dv = myDataTable.DefaultView;

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Li Pang" wrote:
Hi,

I want to know how to create a dataview from a datatable of DISTINCT data.

Thank in advance

Jan 26 '06 #2
Peter,

Thanks for your response. But this solution doesn't resolve my problem.
My situation is:
I have a datatable of many rows and I create a dataview by filtering data.
The dataview has somehow multiple identical rows. My question is how to get a
dataview contains ONLY DISTINCT data.

"Peter Bromberg [C# MVP]" wrote:
DataView dv = myDataTable.DefaultView;

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Li Pang" wrote:
Hi,

I want to know how to create a dataview from a datatable of DISTINCT data.

Thank in advance

Jan 27 '06 #3
Well, in this case you have a couple of choices, since your filter doesn't
appear to
provide what you need:

1) sort the rows in some meaningful way so that whatever "Distinct" you need
shows up in consecutive rows, and iterate over the rows comparing each to the
previous one, throwing out any duplicates and possibly using them to populate
a new DataSet / DataView.
2) do this on the server where your SQL query pre-insures that you get what
you need.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Li Pang" wrote:
Peter,

Thanks for your response. But this solution doesn't resolve my problem.
My situation is:
I have a datatable of many rows and I create a dataview by filtering data.
The dataview has somehow multiple identical rows. My question is how to get a
dataview contains ONLY DISTINCT data.

"Peter Bromberg [C# MVP]" wrote:
DataView dv = myDataTable.DefaultView;

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Li Pang" wrote:
Hi,

I want to know how to create a dataview from a datatable of DISTINCT data.

Thank in advance

Jan 27 '06 #4

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

Similar topics

6
by: Dianna | last post by:
I don't understand why the dataview or the dataset does not have a 'Select Distinct' option. They both can do so much to filter the data except that. The article Microsoft has 326176 works, but not...
2
by: Li Weng | last post by:
Hi, I use a DataView to display a State field. But some rows have the same state like 'OH'. How can I just display only one of them like SQL's DISTINCT? Can I use .rowfilter? How? I don't have...
4
by: luke | last post by:
Hello, I have a dataview that contains about 300k records with 3 cols (read in from a directory). I need to get the count of rows by col1 and col2 (grouping by col1 and col2). What would be the...
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
7
by: Joe | last post by:
Not sure what group this question is better suited for so I sent it to both. I have a DataTable which contains 1545 rows. I have a method that returns a DataTable of distinct rows based on one...
8
by: ASP Yaboh | last post by:
I have an ArrayList of data gathered from a database. I want to create a web page from this data by creating a <table>, each cell in each row displays the appropriate data. One of those cells in...
0
by: amrita | last post by:
hi i have 4 dropdownmenus and m binding them to diff columns of a dataview. want to show only distinct items in the dropdown menu ny filter in dataview to do this thanks in advance amrita
2
by: =?Utf-8?B?cmFuZHkxMjAw?= | last post by:
I have the following line of code (.NET 2.0): myDataView.RowFilter = "SELECT DISTINCT CYCLE_DATE"; where CYCLE_DATE is one of my column names. This throws the following exception: Syntax...
3
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, i have a dataview with a single column in it which contains duplicates. What is the best way to eliminate the duplicates rows so i can turn this column into the primary key? thanks,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.