[V4RB] Adding unique relational records...

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Oct 5 21:36:46 CDT 2004


On 10/5/04 9:07 PM, "Joerg Pressel" <joergp at three-2-one.com> wrote:

> 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?

I do not understand why you use string search for Artist ?

>   cur = database.SQLSelect("select RecID from Artists where Artist='"
> + escStr(s) + "' no_case")

Btw, no_case have sense only for LIKE.

Must be 
    
    where Artists = 145
                    ^^^^ number



-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list