On Wed, Aug 8, 2012 at 4:48 AM, rocko <sunblast...@gmail.com> wrote:
8<

> PUBLIC SUB btnAdd_Click()
>
>   DIM $hConn AS NEW Connection
>   DIM rTable AS Result
>
>   $hConn.Open
>
>   TRY $hConn.Open
>   IF ERROR THEN PRINT "Database cannot be opened. Error = ", Error.Text
>
>   INC Application.Busy
>
>
>   $hConn.Begin
>   rTable = "Inventory"                                                       
> <---- 1
>   rTable!name = txtName.Text
>   rTable.Update                                                               
> <---- 2
>
>   $hConn.Commit
>
> FINALLY
>   DEC Application.Busy
>   $hConn.Close
>
> END

1. You are trying to set a Result to a string value.  This wont work.
2. In order for gb.db to execute a database update it must have a
writeable result.

The answer is:

rTable=$hConn.Edit("Inventory",<some request to get the record you
want to update>)
IF rTable.Available then
  rTable!name=txtName.Text
  rTable.Update
END IF

The help on gb.db has plenty of examples for Result and Connection
explaining these concepts.

hth
Bruce

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to