Kurt Try
Child .sys_Save() varID=Child.sys_Id() Child.sys_Close() OR Parent.sys_Save() varID=Parent.sys_Id() Parent.sys_Close() HTH Regards Sukesh Kurt Hofman <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > It may be a dumb question but how do I know the ID of a record when I'm > creating it > > 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.ToAlbumSetObjectId (PARENT_ID) -> What is the ID of Parent > Child = caFactory2.New("Test.Foto") > Child.Bestand = "Foto_Vertrek.JPG" > Child.Omschrijving = "Vertrek naar Belgi?." > Child.ToAlbumSetObjectId(PARENT_ID) > Parent.sys_Save() > Parent.sys_Close() > > > Kurt > > try > > Child.ToAlbumSetObjectId(the_parent_ID) > > Peter > > 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() > >
