The easiest way is to read the file in using the ReadAllLines method:
string[] lines = File.ReadAllLines(path);
You can then process each line individually:
foreach (string line in lines)
And process each line into two sections:
string[] sections = line.Split('|');
Check you have two sections (or there is an input problem), and then use them:
string name = sections[0];
string age = sections[1];
All you have to do then is save them to your database.
Note: You have nearly all the code you need there: I have left you some work in deciding how to "bolt it all together". Since it is your homework, it is only fair you do some of the work! :laugh: