[Gambas-user] Database table row update

Shane Powell shanep1967 at ...169...
Thu Feb 2 13:01:41 CET 2012


On 02/02/12 22:49, John Rose wrote:
> 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
>
>
>
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
>
>
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
I have not looked at all your code but are you get your result by doing
result = dbconnection.edit("table")
then you can edit a field , update ,commit




More information about the User mailing list