Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Uncommitted changes
Message
 
To
20/11/2000 15:50:29
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00443327
Message ID:
00443835
Views:
12
It may depend on how the tables are buffered in the form (trying using 5 if you are not already).

And i would also try commenting out the "CALCULATE SUM(Lines.LHours) TO lnTotalHours" line during debugging. I think you are moving the record pointer when this command is run and it could be contributing to the problem.





>1) I thought of that. I tried TABLEUPDATE(.T.,.T.,"Lines"). It worked fine on the table update lines but when I tried to leave the grid going to the save button it poped the error trying to refresh the grid REQUERY("Lines"). Lines is a parameterized view based on a foreign key pointing to the PK of the header file. I use a public var gnKey (defined in the Load method of the form and the view definition) as the parameter
>
>2) I thought of that too. I made sure I only changed one record - I marked the deletion box on the one and only one record. Same error.
>
>3) Yes, the error poped up when I hit the refresh on the grid see 1 above
>
>4a) Yes the form is set to optomistic buffering.
>4b) This is worth investigating further. Are you saying I should do a table update on the Header & Line tables first and then on the 'Lines' view?
>
>As for the old format of table update, that doesn't supprise me. I am old so my code is probably old too. What are we using for the format now?
>
>Thanks for your help. Your replies are as always to the point and helpfull.
>
>Terry
>
>
>
>>Terry,
>>Several things come to mind.
>>
>>First (very basic) - are you sure you're doing the TableUpdate() on the correct view?
>>
>>Second, could there be changes in more than one record? You're using an older format for TableUpdate() which uses .T. and updates only the active record. What is your buffering value? If table buffering then there could be other records with uncommitted changes.
>>
>>Third, you are getting none of your error messages back so I'm assuming that the code proceeded to the End Transaction line. Have you walked through it with the debugger?
>>
>>Fourth, are your underlying tables buffered? If so you will have to run a TableUpdate() on them too.
>>
>>I hope this will help get your started again.
>>
>>Barbara
>>
>>
>>
>>>I am using a parameterized view in a grid to maintain a file. The view ("Lines") definition follows:
>>>
>>>SELECT * FROM log!loglines WHERE DELETED() = .F. AND Loglines.head_fk = ?gnhead_pk ORDER BY Loglines.pk
>>>
>>>The SQL UPDATE box is checked, all fields are marked updatable, & the key field is LogLines.PK ( a unique integer primary key).
>>>
>>>As the logheader record pointer changes the grid.refresh method sets gnHead_PK to the header primary key integer and does a REQUERY("Lines")
>>>
>>>My problem comes when I save my changes. In this case I deleted an extra line record. The save code is as follows.
>>>
>>>   ****************************************************************************
>>>   ***   Saving changes
>>>   ****************************************************************************
>>>   SET MULTILOCKS ON
>>>   BEGIN TRANSACTION
>>>      IF !TABLEUPDATE(.T.,.T.)
>>>
>>>      ROLLBACK
>>>         = MESSAGEBOX( ;
>>>              "SORRY! A program error occured.  Please tell the programmer " +;
>>>              "that the 'TableUpdate' function called by the cmdAdd.Click " + ;
>>>              "method failed." + CHR(13) + ;
>>>              "Unfortunately, your changes were NOT saved.", 0+16+0)
>>>
>>>       ELSE
>>>
>>>          CALCULATE SUM(Lines.LHours) TO lnTotalHours
>>>          IF lnTotalHours <> ThisForm.txtHours.Value
>>>            = MESSAGEBOX(;
>>>              "The total hour field does not match the hours " + CHR(13) + ;
>>>              "entered on the lines.  Changing the total to match.",0+16+0)
>>>            REPLACE LogHeader.DHours WITH lnTotalHours
>>>
>>>             IF !TABLEUPDATE(.T.,.T.,"LogHeader")
>>>               ROLLBACK
>>>               = MESSAGEBOX( ;
>>>                  "SORRY! The total hour field was NOT updated. You will " + ;
>>>                  "have to do it manually as an error took place during " + ;
>>>                  "the save.", 0+16+0)
>>>            ENDIF update logheader
>>>
>>>       ENDIF <>
>>>
>>>    ENDIF tableupdate
>>>   END TRANSACTION
>>>
>>>When the form refreshes I get an "the table buffer for view "lines" contains uncommitted changes" error. I have been fooling with this for two days now and am getting fed up with my obvious ignorance. I tried tableupdate(.t.,.t.,"Lines") in various places with no luck. I moved the tableupdate code to the delete method of the grid, no luck. Every time the tableupdate function seems to work fine but the changes never get committed.
>>>
>>>HELP! :(
>>>
>>>Thanks in advance
>>>
>>>Terry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform