implementing 1-N association

I want to recore samo data in database table. Let me say the name of the table as Educaton. Table Educatin has a 1-N relationship with the table Person. To do this, I have create two class as follows.

public Class Person
    //I have create the association as collections
    public System.Collection.ArrayList myEducation=new ArrayList();
    private int educationPointer=0;

    //I have created a method that is used for populating the data list
    public addEducation( Education me)
          myEducation.add (me)

Public Class Education
   //I have a method to save all the Education Information
    public System.Boolean Save()
         //In this method I have called the some method to execute the necessary sql string

For both classes, I have coded the properties and variables but I do not write them here.

My problem is like that;
From now on What should be the coding strategy in order to implement the 1-n association between the Education and Person Class and save the Education information to the database.

Many thanks
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I think you mean 1 to n for Person to Education rather than what you aid above. You should have a Save on the Person not the Education Class.

You would open a transaction and save the person. You would then loop through all the eduction classes and save their details relating to the person. If anything fails then you rollback the transaction, otherwise you commit e.g.

Public Class Person

    Public Sub Save()

            Dim conn As New SqlConnection

            'do person insert getting back person identifier
            Dim personId as Integer = insertCommand.Execute

            for each e as Eduction in myEducation
                'do the education insert


        catch ex as Exception

    End Sub

End Class
emrahtufanAuthor Commented:
Thanks for your response culshaja
Yes you're right.  I mean one person and many education related with the person.
Your code seems good but actually my user interface application composed of succesive page.
For example a person log on to the web site and then want to add their education information (high schools, college etc.)
So I have a person record on the database.
Person goes to the  AddEducation page and then save his/her education information by button click. What I want to do exactly is that;
I want to add the education info in the arraylist on de PersonClass and then add the items in the arraylist to the database.

Hope I can explain the situation.
emrahtufanAuthor Commented:
any comment?
What you then need to do is just do the same idea with the loopingthrough the arraylist nested witin a transaction. In this case you will alredy have the person Id so you don't need to add it again.

james :-)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
emrahtufanAuthor Commented:
many thanks james:)
one more question.
in environment,
how can I fill the array list.
I mean each time I click the button on the page, the class person is called and the array is created again and again so I cannot make the array persistent on the memory.
How can I achive the problem?
Many many thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.