I'm trying to add records to a relationship in Visual basic .NET 2003.

But how can I set the 'To'-property of the child-table ???


Test.Album (Parent - one)

-          Test.Foto (Child - many)


Classes:


Class Test.Album Extends %Persistent [ ClassType = persistent,
ProcedureBlock ]
{
Relationship Foto As Test.Foto [ Cardinality = parent, Inverse = ToAlbum ];
Property Naam As %String;
Property Omschrijving As %String;
}


Class Test.Foto Extends %Persistent [ ClassType = persistent,
ProcedureBlock ]
{
Property Bestand As %String;
Property Omschrijving As %String;
Relationship ToAlbum As Test.Album [ Cardinality = children, Inverse =
Foto ];
}

 Code :

        Dim Parent, Child As Object

         Parent = caFactory1.New("Test.Album")

        Parent.Naam = "Vakantie 2004"

        Parent.Omschrijving = "Spanje !!!"

        Child = caFactory2.New("Test.Foto")

        Child.Bestand = "Foto_Aankomst.JPG"

        Child.Omschrijving = "Aankomst in Spanje."

        Child.ToAlbum =
             -> Error

        Child = caFactory2.New("Test.Foto")

        Child.Bestand = "Foto_Vertrek.JPG"

        Child.Omschrijving = "Vertrek naar Belgi�."

        Child.ToAlbum =
             -> Error

        Parent.sys_Save()

        Parent.sys_Close()









Reply via email to