473,549 Members | 2,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataTable DataRow Delete Duplicate Rows

Hi All,

i have a datatable in which iam creating 2 datacolumns , one is SampleID and
second is TestType.

iam creating a datarow depending on a for loop, if the for loop goes 5 times
it will insert 5 records.

every thing works well, what i want is to delete the Duplicate Rows

the data what iam getting is

SampleID TestType
6836 NMR
6836 NMR
6836 NMR
6836 MS
6836 MS
6836 Report

what i want is it should just have
SampleID TestType
6836 NMR
6836 MS
6836 Report

thats it, any help would be greatful.

Thanks & Regards
Vijay Pote

Nov 17 '05 #1
4 14393
Can you have your loop check to see if the row is already there, and if it
is, just not do the insert?

"Vijay Pote" <Vijay Po**@discussion s.microsoft.com> wrote in message
news:4A******** *************** ***********@mic rosoft.com...
Hi All,

i have a datatable in which iam creating 2 datacolumns , one is SampleID
and
second is TestType.

iam creating a datarow depending on a for loop, if the for loop goes 5
times
it will insert 5 records.

every thing works well, what i want is to delete the Duplicate Rows

the data what iam getting is

SampleID TestType
6836 NMR
6836 NMR
6836 NMR
6836 MS
6836 MS
6836 Report

what i want is it should just have
SampleID TestType
6836 NMR
6836 MS
6836 Report

thats it, any help would be greatful.

Thanks & Regards
Vijay Pote

Nov 17 '05 #2
You mean like check for a duplicate key?

Nov 17 '05 #3
Thanks Marina,

I am trying that, but is there anyway to do it in DataTable.

Thanks & Regards
Vijay Pote

"Marina" wrote:
Can you have your loop check to see if the row is already there, and if it
is, just not do the insert?

"Vijay Pote" <Vijay Po**@discussion s.microsoft.com> wrote in message
news:4A******** *************** ***********@mic rosoft.com...
Hi All,

i have a datatable in which iam creating 2 datacolumns , one is SampleID
and
second is TestType.

iam creating a datarow depending on a for loop, if the for loop goes 5
times
it will insert 5 records.

every thing works well, what i want is to delete the Duplicate Rows

the data what iam getting is

SampleID TestType
6836 NMR
6836 NMR
6836 NMR
6836 MS
6836 MS
6836 Report

what i want is it should just have
SampleID TestType
6836 NMR
6836 MS
6836 Report

thats it, any help would be greatful.

Thanks & Regards
Vijay Pote


Nov 17 '05 #4
Here is something that has that element in it. Maybe it can help:

http://www.aspheute.com/english/20040123.asp

Nov 17 '05 #5

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

Similar topics

1
15734
by: frank | last post by:
I have two DataTables, A and B. Both have the primary key "CID". How do I remove all entries in Table A from Table B (with the same PK)?
5
2462
by: Nathan Sokalski | last post by:
I am writing an ASP.NET application in which I need to copy DataRows from one DataTable to another. When I use code such as the following: temprows = nodes.Select("state='PA'") temptable.Clear() For Each row As DataRow In temprows temptable.Rows.Add(row) Next
3
1710
by: Fred Nelson | last post by:
Hi: I have created a datatable and I'm able to access it by key values. I need to be able to go to the "top" of the datatable and process records sequentially until they are completed. I can't figure out the command to set me to the top or "beginning" and then read. (datatable.select?)
3
7139
by: Agnes | last post by:
I need to Load 4thousand record into a datagrid for the user to choose. After the user click the row, I will save it. Now, How can I remove the uncheck row. Dim myDelRowArray() As DataRow = dtRvDetail.Select("check = false ") Me.dtRvDetail.Rows.Remove(myDelRowArray) <-- I know there is error, since i cannot delete the datarowarray. Any...
4
8521
by: Jason | last post by:
I have a DataTable from which I am trying to delete rows using the DataGrid control. However, I'm having trouble maintaining the changes to the DataTable between PostBacks. This is my first go 'round with the DataGrid control, so pardon me if there are glaring mistakes... public partial class control_panel_mail_Default : System.Web.UI.Page...
3
5382
by: Niyazi | last post by:
Hi all, I have a dataTable that contains nearly 38400 rows. In the dataTable consist of 3 column. column 1 Name: MUHNO column 2 Name: HESNO Column 3 Name: BALANCE Let me give you some example first:
7
6591
by: Susan Mackay | last post by:
I have a data table that is connected to a database table with a data adapter in the 'standard' manner. However I want to be able to remove selected rows from the data table (i.e. no longer include them in the set that is displayed to the user) but I don't want to delete the corresponding row from the database. I've tried using the...
7
16195
by: Doug Bell | last post by:
Hi, I have a DataSet with a DataTable that has a number of duplicate rows (except for one column that has a unique value). Each row has OrderNo, OrderLineNo, etc and there are multiple rows with the same OrderNo and OrderLineNo. I need to display data in a DataGrid but displaying only one record for each OrderNo OrderLineNo.
4
25976
by: =?Utf-8?B?cmFuZHkxMjAw?= | last post by:
I'm working in Visual Studio 2005 and C#. I have a DataTable with many rows. The user can delete a row. After the row is deleted, I'd like to column values for the deleted row, but any attempt to access column values results in the following exception: {"Deleted row information cannot be accessed through the row."} My understanding is...
0
7518
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7446
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7956
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7469
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6040
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5087
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1935
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.