[Gambas-user] Database table row update

John Rose john.aaron.rose at ...626...
Thu Feb 2 12:49:22 CET 2012


I think that I've narrowed down this problem on the attached Test
project. The run time error on the starred line below is an error
message stating "Update database site table record error" & "Error:
Result is read-only":
Public Sub ButtonSave_Click()
  Dim latitude As Float
  Inc Application.Busy
  Print "Start of Latitude Update"
  latitude = ValueBoxLatitude.Value
  DatabaseConnection.Begin
  ' ResultSite.MoveTo(1)  ' this line is unnecessary
  ' as the Open form procedure uses it
  ' I get the same run-time message with it
  Print "Old latitude", ResultSite["latitude"]
  Print "New latitude", latitude
  Print 1
*****  ResultSite["latitude"] = latitude  ****
  Print 2
  ResultSite.Update()
  Print 6
  DatabaseConnection.Commit
  Print "End of Latitude Update"
Finally
  Dec Application.Busy 
Catch
  DatabaseConnection.Rollback
  Error.Raise("<b>Update database site table record
error</b><hr>Error:<br>" & DConv(Error.Text))
End

I'm obviously missing something elementary about updating a field in one
of a database's table's rows.

PS ResultSite is a Result which contains 2 rows from the site table in
the SQLite3 Test.db database


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.tar.gz
Type: application/x-compressed-tar
Size: 17413 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20120202/ad2d8452/attachment.bin>


More information about the User mailing list