Reading RecID after Add()
James Milne
james.milne at mac.com
Mon Feb 23 17:47:45 CST 2004
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")
--
James Milne
More information about the Valentina
mailing list