Text file operation string..

MSIE

New member
Joined
Dec 12, 2010
Messages
1
Programming Experience
Beginner
This are the contents in my text file

-------OLD Records already added to database----
C01, Liam
C02, Dunham

-------New Records pending to be added to database---
C03, Chris
C04, Tommy

When loading from this textfile, how do i check that the old records does exist in this database and skipped it. So it will move on and add the new records. Reason is because if i don't do a check, it will display "Primary key violation for C01, C02, etc"
 
You know what the header line contains for the new records so just read and discard lines up until you reach that line. From then on, use the lines rather than discarding them.
 
Unless his data is simply:
C01, Liam
C02, Dunham
C03, Chris
C04, Tommy

In which case he'll want to check each one against the database and if a row comes back then it already exists, if not then he'll know to add that one.
 
Back
Top