471,325 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 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 4282
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Dianna | last post: by
2 posts views Thread by Li Weng | last post: by
4 posts views Thread by luke | last post: by
8 posts views Thread by ASP Yaboh | last post: by
reply views Thread by amrita | last post: by
2 posts views Thread by =?Utf-8?B?cmFuZHkxMjAw?= | last post: by
3 posts views Thread by =?Utf-8?B?cm9kY2hhcg==?= | last post: by
reply views Thread by rosydwin | last post: by

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.