Hi, Try $hConn.Exec("INSERT INTO 'inventory' (your Column) VALUES ('" & txtName.Text & "')
Ivan -----Ursprüngliche Nachricht----- Von: rocko [mailto:sunblast...@gmail.com] Gesendet: Mittwoch, 8. August 2012 05:14 An: mailing list for gambas users Betreff: Re: [Gambas-user] Adding values to fields in SQLite table?? So should rTable be set as String not Result?? I've tried both and I still can't get the DB to update. $hConn.Begin rTable = $hConn.Edit("inventory") IF rTable.Available THEN rTable!name = txtName.Text rTable.Update ENDIF $hConn.Commit FINALLY $hConn.Close On Wed, 2012-08-08 at 12:18 +0930, Adam Ant wrote: > 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 ---------------------------------------------------------------------------- -- 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 ------------------------------------------------------------------------------ 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