Reading RecID after Add()

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Feb 23 19:51:38 CST 2004


on 2/23/04 7:47 PM, James Milne at james.milne at mac.com wrote:

> Hi Guys,
> 
> I'm wanting to insert a record into a table after having used an empty
> cursor to insert it, like so:
> 
>  Dim statement as String
>  Dim resultSet as VCursor
>  Dim recordId as Integer
> 
>  ' Create statement to get empty resultset
>  statement = "select RecID, * from timeline where RecID = 0"
> 
>  ' Execute statement to get empty resultset
>  resultSet = me.db.SqlSelect( statement, kV_Client, kV_ReadWrite )
>  if (resultSet = nil) then
>    return nil
>  end if
> 
>  ' Clear this cursor
>  resultSet.SetBlank()
> 
>  ' Set the fields of the cursor ready to create a record
>  resultSet.VarcharField("name") = inName
> 
>  ' Create this recored
>  if not resultSet.Add() then
>    return nil
>  end if
> 
>  if not resultSet.Update() then
>    return nil
>  end if
> 
> After the Add, I want to read the RecID generated back out. Will this
> work
> correctly?
> 
>  ' Read the record ID
>  recordId = resultSet.ULongField("RecID")

yes

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