[V4RB] Adding unique relational records...

Joerg Pressel joergp at three-2-one.com
Tue Oct 5 20:07:40 CDT 2004


Hi,

I have a table "Tracks" pointing to a table "Artists" and use the 
following code in "Artists" to add a new unique artist:

Function AddArtist(s as string) As integer
    dim cur As VCursor

    cur = database.SQLSelect("select RecID from Artists where Artist='" 
+ escStr(s) + "' no_case")
    if (cur.recordCount = 0) then
       SetBlank
       Artist.value = s
       AddRecord
       return GetRecID
    else
       return cur.ULongField(1).value
    end if

End Function

In "Tracks" I call it like:
mArtistPtr.value = musicDatabase(dataBase).mArtists.AddArtist(artist)

Is there an easier, perhaps faster way to do this?

Thanks for any comment,

Jörg


More information about the Valentina mailing list