![]() |
|
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
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 <> wrote in message news:... > 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 > |
|
|
|
#3 |
|
Posts: n/a
|
Does anyone have any idea on how I should do this?
J <> wrote in message news:... > 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 > > <> wrote in message > news:... >> 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 >> > > |
|
|
|
#4 |
|
Posts: n/a
|
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 |
|
|
|
#5 |
|
Posts: n/a
|
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]"" <v-> wrote in message news:... > 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 > |
|
|
|
#6 |
|
Posts: n/a
|
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 |
|
|
|
#7 |
|
Posts: n/a
|
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]"" <v-> wrote in message news:... > 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 > |
|
|
|
#8 |
|
Posts: n/a
|
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 |
|
|
|
#9 |
|
Posts: n/a
|
Yuan,
Thanks for the response. I posted a thread there and am waiting on a response. Thanks again! J ""Yuan Ren[MSFT]"" <v-> wrote in message news:gAof$... > 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 > |
|
|
|
#10 |
|
Posts: n/a
|
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 |
|