PC Review


Reply
Thread Tools Rate Thread

Dataset (checking duplicate record)

 
 
Arvi
Guest
Posts: n/a
 
      15th Dec 2006
Hi,

Is there any way to check for the duplicated (fluteid) records in the
dataset other than the following method?

i need to avoid goin thru all the records everytime (squaremethod) instead
i want to check with the triangle method. can someone help me here?



foreach (Dataset.FluteRow row in dataSet.Flute.Rows)

{

idToCheck = row.FluteID;

linkToCheck = row.FluteLink;



foreach (Dataset.FluteRow row1 in dataSet.Flute.Rows)

{

if(row1.FluteID == idToCheck && row1.FluteLink != linkToCheck)

{

duplicateID.Add(row1.FluteID);

}

}


}


 
Reply With Quote
 
 
 
 
Arvi
Guest
Posts: n/a
 
      18th Dec 2006
ok thanks..

i figured out a solution

for(int i = 0; i < dataSet.table.Rows.Count ; i++)

{

Dataset.Row row = dataSet.table.Rows[i] as Dataset.Row;

if(row.RowState.ToString() != "Deleted")

{

idToCheck = row.ID;

linkToCheck = row.Link;

}

for(int j=i+1; j < dataSet.table.Rows.Count; j++)

{

Dataset.Row row1 = dataSet.table.Rows[j] as Dataset.Row;

if(row1.RowState.ToString() != "Deleted")

{

if(row1.ID == idToCheck)

{

duplicateID.Add(row1);

}

}

}


}




"Ciaran O''Donnell" <(E-Mail Removed)> wrote in
message news:E7140369-FC58-4FB4-A704-(E-Mail Removed)...
> is this data from a database, if so then you should be performing the
> checking there as the dbms will have an efficient way of doing it.
> Other wise I dont know of a way to do it bar using the select method on
> the
> datatable for each row. that stops the nested loops in your code but
> really
> just moves one into the datatable object. will possibly be faster though.
>
> --
> Ciaran O''''Donnell
> http://wannabedeveloper.spaces.live.com
>
>
> "Arvi" wrote:
>
>> Hi,
>>
>> Is there any way to check for the duplicated (fluteid) records in the
>> dataset other than the following method?
>>
>> i need to avoid goin thru all the records everytime (squaremethod)
>> instead
>> i want to check with the triangle method. can someone help me here?
>>
>>
>>
>> foreach (Dataset.FluteRow row in dataSet.Flute.Rows)
>>
>> {
>>
>> idToCheck = row.FluteID;
>>
>> linkToCheck = row.FluteLink;
>>
>>
>>
>> foreach (Dataset.FluteRow row1 in dataSet.Flute.Rows)
>>
>> {
>>
>> if(row1.FluteID == idToCheck && row1.FluteLink != linkToCheck)
>>
>> {
>>
>> duplicateID.Add(row1.FluteID);
>>
>> }
>>
>> }
>>
>>
>> }
>>
>>
>>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Checking for duplicate record Secret Squirrel Microsoft Access 3 11th Sep 2009 03:25 AM
Duplicate record checking Steve in MN Microsoft Access VBA Modules 1 11th Dec 2008 05:01 AM
Dataset (checking duplicate record) Arvi Microsoft Dot NET 0 15th Dec 2006 11:43 PM
How to remove duplicate record when using Dataset.merge kiki Microsoft ASP .NET 0 1st Jun 2006 03:09 AM
Duplicate Record Error Checking Dave Microsoft Access Forms 1 27th Dec 2003 07:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:56 AM.