Click here to Skip to main content
15,120,619 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Sorting numbers then adding to a database Pin
Chris_B8418-Dec-11 2:25
MemberChris_B8418-Dec-11 2:25 
GeneralRe: Sorting numbers then adding to a database Pin
Richard MacCutchan18-Dec-11 5:39
mveRichard MacCutchan18-Dec-11 5:39 
GeneralRe: Sorting numbers then adding to a database Pin
Chris_B8418-Dec-11 6:23
MemberChris_B8418-Dec-11 6:23 
AnswerRe: Sorting numbers then adding to a database Pin
Not Active18-Dec-11 10:03
mentorNot Active18-Dec-11 10:03 
Questionrelated news function? Pin
duongvannam16-Dec-11 18:39
Memberduongvannam16-Dec-11 18:39 
AnswerRe: related news function? Pin
Not Active17-Dec-11 4:54
mentorNot Active17-Dec-11 4:54 
QuestionComparing array of strings Pin
indian14316-Dec-11 7:23
Memberindian14316-Dec-11 7:23 
AnswerRe: Comparing array of strings Pin
Morgs Morgan17-Dec-11 9:57
MemberMorgs Morgan17-Dec-11 9:57 
indian143 wrote:
I have an asp.net application which loads data from csv file. I need to check for duplicate rows in the csv file and should not process them and give error message for those duplicate rows.


Here's my approach:
C#
//list to add lines in your csv file
ArrayList uniqueLines = new ArrayList();
ArrayList duplicateLines = new ArrayList();

//Read all lines from your csv file
String[] lines = File.ReadAllLines( "C:/file.csv" );//passing the file path

foreach ( String line in lines )
{
   if ( !uniqueLines.Contains( line ) )
   {
      uniqueLines.Add( line );
   }
   else
   {
      duplicateLines.Add( line );
   }

}


From the above, you have all the unique lines in the uniqueLines arraylist and you have duplicate lines in the duplicateLines arraylist.
To display errors, loop through the "duplicateLines" and tell the user about the error.

Happy Coding,
Morgs
GeneralRe: Comparing array of strings Pin
indian14318-Dec-11 15:03
Memberindian14318-Dec-11 15:03 
GeneralRe: Comparing array of strings Pin
Morgs Morgan18-Dec-11 20:06
MemberMorgs Morgan18-Dec-11 20:06 
GeneralRe: Comparing array of strings Pin
indian14318-Dec-11 22:03
Memberindian14318-Dec-11 22:03 
Questionhow to show a pupup on my parant window. Pin
Jitendra Parida - Jeetu16-Dec-11 2:59
MemberJitendra Parida - Jeetu16-Dec-11 2:59 
AnswerRe: how to show a pupup on my parant window. Pin
Dennis E White16-Dec-11 6:30
professionalDennis E White16-Dec-11 6:30 
GeneralRe: how to show a pupup on my parant window. Pin
Jitendra Parida - Jeetu17-Dec-11 2:06
MemberJitendra Parida - Jeetu17-Dec-11 2:06 
GeneralRe: how to show a pupup on my parant window. Pin
Dennis E White17-Dec-11 6:42
professionalDennis E White17-Dec-11 6:42 
GeneralRe: how to show a pupup on my parant window. Pin
Jitendra Parida - Jeetu18-Dec-11 19:39
MemberJitendra Parida - Jeetu18-Dec-11 19:39 
QuestionHow to deploy my website in server by command Pin
BalasubramanianK15-Dec-11 23:42
MemberBalasubramanianK15-Dec-11 23:42 
QuestionRequest.ServerVariable("REMOTE_HOST") Pin
uspatel15-Dec-11 19:38
professionaluspatel15-Dec-11 19:38 
Questionasp.net vertical menu Pin
ninad_jad15-Dec-11 2:05
Memberninad_jad15-Dec-11 2:05 
AnswerRe: asp.net vertical menu Pin
nainakarri15-Dec-11 22:00
Membernainakarri15-Dec-11 22:00 
GeneralRe: asp.net vertical menu Pin
Jitendra Parida - Jeetu23-Dec-11 21:33
MemberJitendra Parida - Jeetu23-Dec-11 21:33 
AnswerRe: asp.net vertical menu Pin
Jitendra Parida - Jeetu23-Dec-11 21:43
MemberJitendra Parida - Jeetu23-Dec-11 21:43 
QuestionThe steps of hosting a website? Pin
Jitendra Parida - Jeetu15-Dec-11 1:07
MemberJitendra Parida - Jeetu15-Dec-11 1:07 
AnswerRe: The steps of hosting a website? Pin
kribo15-Dec-11 4:50
professionalkribo15-Dec-11 4:50 
GeneralRe: The steps of hosting a website? Pin
Jitendra Parida - Jeetu15-Dec-11 22:12
MemberJitendra Parida - Jeetu15-Dec-11 22:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.