[Gambas-user] Adding values to fields in SQLite table??

Adam Ant adamnt42 at ...626...
Wed Aug 8 08:03:41 CEST 2012


On Wed, Aug 8, 2012 at 2:59 PM, Fabien Bodard <gambas.fr at ...626...> wrote:
> Le 8 août 2012 04:49, "Adam Ant" <adamnt42 at ...626...> a écrit :
>> The answer is:
>>
> It's create
>> rTable=$hConn.create("Inventory",<some request to get the record you
>> want to update>)
>> IF rTable.Available then
>>   rTable!name=txtName.Text
>>   rTable.Update
>> END IF
>>
>
> Don't open/ close the db each time
>

Yes, sorry Roko (and Fabien), I forgot you were trying to ADD a new row.

So it's really
  rTable=$hConn.Create("Inventory")
  IF rTable.Available then
    rTable!name=txtName.Text
    TRY rTable.Update
    IF ERROR THEN
'       your update failed, possibly because of a duplicate key
    ENDIF
  END IF


Bruce




More information about the User mailing list