Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Gridview Duplicate removal.

Reply
Thread Tools

Gridview Duplicate removal.

 
 
Guest
Posts: n/a
 
      02-07-2006
Hello,

How would I remove duplicate rows from a dataset after it has already been
populated?

What would be the best way to check each row and delete duplicates while
leaving at least one unique of the duplicate rows?

Any Ideas?

Thanks in advance,

J


 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      02-07-2006
Oops,

My subject was probably misleading. Let me clarify.

My gridview in my asp.net 2.0 site is populated by a dataset not a
datasource.

Thanks,

j

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> How would I remove duplicate rows from a dataset after it has already been
> populated?
>
> What would be the best way to check each row and delete duplicates while
> leaving at least one unique of the duplicate rows?
>
> Any Ideas?
>
> Thanks in advance,
>
> J
>



 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      02-07-2006
Does anyone have any idea on how I should do this?

J

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Oops,
>
> My subject was probably misleading. Let me clarify.
>
> My gridview in my asp.net 2.0 site is populated by a dataset not a
> datasource.
>
> Thanks,
>
> j
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hello,
>>
>> How would I remove duplicate rows from a dataset after it has already
>> been populated?
>>
>> What would be the best way to check each row and delete duplicates while
>> leaving at least one unique of the duplicate rows?
>>
>> Any Ideas?
>>
>> Thanks in advance,
>>
>> J
>>

>
>



 
Reply With Quote
 
Yuan Ren[MSFT]
Guest
Posts: n/a
 
      02-08-2006
Hi J,

Thanks for posting!

For the current issue, I wonder the duplicated row is encountered in the
data base layer or the dataset layer?

In the dataset layer, there is not existed method to delete the duplicated
row. Since there are many duplicated rows such like duplicated primary key,
or duplicated one column, I think you can write your own method to
implement it in the dataset layer.

Thanks for your understanding!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support

 
Reply With Quote
 
Guest
Posts: n/a
 
      02-08-2006
The data that I bring into the dataset is from two tables in my sql database
and it's a many to many relationship. I use an sql join statement and when
I do I end up with the following:

(PartNumber Column)
10024
10024
10024
10025
10025
10067
10067
10067

What I want it to look like is this:

10024
10025
10067

I am not familiar enough with SQL statements to fix this problem in the sql
join statement so I figured I could just remove the extra rows after the
fact in either the dataset or the Gridview.

Thanks,

J


""Yuan Ren[MSFT]"" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi J,
>
> Thanks for posting!
>
> For the current issue, I wonder the duplicated row is encountered in the
> data base layer or the dataset layer?
>
> In the dataset layer, there is not existed method to delete the duplicated
> row. Since there are many duplicated rows such like duplicated primary
> key,
> or duplicated one column, I think you can write your own method to
> implement it in the dataset layer.
>
> Thanks for your understanding!
>
> Regards,
>
> Yuan Ren [MSFT]
> Microsoft Online Support
>



 
Reply With Quote
 
Yuan Ren[MSFT]
Guest
Posts: n/a
 
      02-09-2006
Hi J,

Thanks for your reply!

As I replied in the pervious thread, you need write your own method for
deleting the duplicated row. For example, you can read the row from the
current dataset. Then, you judge whether the next row is duplicated with
the current. If this is true, you get rid of the current row and read the
next. After this judgment, you can put the data to a new dataset and bind
the dataset with the GridView control.

Thanks for your understanding!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support

 
Reply With Quote
 
Guest
Posts: n/a
 
      02-09-2006
Oh, I get it. That makes perfect sense. I did not gather that from your
last post but I understand clearly now.

Will that way of doing it be the least processor intensive?
In some instances there could be over 10,000 or more rows.

I wish I was more familiar with SQL Statements because I am sure that all
this could be done before hand when the data is called from the database. I
just dont understand how to do that.

I will definantly try the two dataset approach and let you know how that
works out.

Regards,

J

""Yuan Ren[MSFT]"" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi J,
>
> Thanks for your reply!
>
> As I replied in the pervious thread, you need write your own method for
> deleting the duplicated row. For example, you can read the row from the
> current dataset. Then, you judge whether the next row is duplicated with
> the current. If this is true, you get rid of the current row and read the
> next. After this judgment, you can put the data to a new dataset and bind
> the dataset with the GridView control.
>
> Thanks for your understanding!
>
> Regards,
>
> Yuan Ren [MSFT]
> Microsoft Online Support
>



 
Reply With Quote
 
Yuan Ren[MSFT]
Guest
Posts: n/a
 
      02-13-2006
Hi J,

Thanks for your reply!

>"Will that way of doing it be the least processor intensive?"

Unfortunately, I think the current method will take more time to execute
when there are more rows in the dataset. So, I think you can post a new
thread to the SQL newsgroup if you think the performance is the key point.
Thanks for your understanding!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support

 
Reply With Quote
 
Guest
Posts: n/a
 
      02-14-2006
Yuan,

Thanks for the response. I posted a thread there and am waiting on a
response.

Thanks again!

J

""Yuan Ren[MSFT]"" <(E-Mail Removed)> wrote in message
news:gAof$(E-Mail Removed)...
> Hi J,
>
> Thanks for your reply!
>
>>"Will that way of doing it be the least processor intensive?"

> Unfortunately, I think the current method will take more time to execute
> when there are more rows in the dataset. So, I think you can post a new
> thread to the SQL newsgroup if you think the performance is the key point.
> Thanks for your understanding!
>
> Regards,
>
> Yuan Ren [MSFT]
> Microsoft Online Support
>



 
Reply With Quote
 
Yuan Ren[MSFT]
Guest
Posts: n/a
 
      02-14-2006
Hi J,

You are welcome! If you have any further information related to this
problem, please feel free to post here. Thanks very much and looking
forward to hearing from you.

Yuan Ren [MSFT]
Microsoft Online Support

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Preventing Duplicate field information on gridview update? =?Utf-8?B?SGF3aw==?= ASP .Net 0 02-21-2007 01:08 AM
Can't duplicate ID in subclassed GridView David Thielen ASP .Net Web Controls 4 10-27-2006 03:32 AM
Duplicate TemplateField in a custom control deriving from GridView Sunny ASP .Net Web Controls 0 07-14-2006 12:32 AM
GridView Hierarchical View - Gridview in Gridview =?Utf-8?B?bWdvbnphbGVzMw==?= ASP .Net 1 05-09-2006 06:48 PM
GridView in a GridView Nalaka ASP .Net 6 12-05-2005 05:48 PM



Advertisments