Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: Steven Rebello
  Where is Steven Rebello?
 Bangalore
 India
 Steven Rebello
Subject: RE: Changes to a view through a grid
Thread ID: 184778 Message ID: 184785 # Views: 2 # Ratings: 0
Version: Visual FoxPro 9 Category: Grids
Date: Sunday, July 20, 2008 9:54:19 PM         
   



> Dear Friends,
>
> I had this mind boggling problem with updating a view through a grid, and it took me days to figure out the real problem.
>
> Finally I located one of the culprits. But I need to know how the course for reform.
>
> I realised that in a view that is updateable through a grid, if I make a change to one of the cells, and move to the next cell by using the mouse, or the down arrow, I get the error 'View XYZ contains uncommitted changes'. However, if I commit the change in the cell using the 'Enter' button, no problem.
>
> Why is this happening, and how do I resolve it?

Hello Steve -

The error 'View XYZ contains uncommitted changes' itself sound as if your code (perhaps in grid.AfterRowColChange?) is attempting a Requery('yourView') before you made a TableUpdate() attempt (or a Tablerevert(), respectively).
I believe you do not want that Requery() at that point, in the first place.
Does that help?

Don't keep on reading if you know this already:-)
Default buffering of Vfp Views is 3 (optimistic row buffering).
That means each record pointer move causes an implicit TableUpdate() attempt on a modified row.
But TableUpdate() can return False, so you may not want the implicit one but rather do an explicit TableUpdate() programmatically (so that you can use AError() if it had returned False).

When you allow editing directly in a Grid, the alternate way would be to use buffer mode 5 (optimistic table buffering). That way you do not need to prevent moving record pointers.
So you could have a "Save" button somewhere next to the Grid (and a "Revert" button, too).

Anyway, you can only Requery('yourView') after your TableUpdate() or Tablerevert() methods have been done.


hth
-Stefan

ENTIRE THREAD

Changes to a view through a grid Posted by Steven Rebello @ 7/20/2008 8:06:36 PM
RE: Changes to a view through a grid Posted by Anders Altberg @ 7/20/2008 9:51:11 PM
RE: Changes to a view through a grid Posted by Steven Rebello @ 7/21/2008 3:49:45 AM
RE: Changes to a view through a grid Posted by Stefan Wuebbe @ 7/21/2008 8:12:15 AM
RE: Changes to a view through a grid Posted by Anders Altberg @ 7/21/2008 11:42:28 AM
RE: Changes to a view through a grid Posted by Stefan Wuebbe @ 7/20/2008 9:54:19 PM
RE: Changes to a view through a grid Posted by Steven Rebello @ 7/21/2008 3:38:31 AM
RE: Changes to a view through a grid Posted by tushar @ 7/21/2008 6:47:10 AM
RE: Changes to a view through a grid Posted by Steven Rebello @ 7/22/2008 6:35:00 PM
RE: Changes to a view through a grid Posted by Stefan Wuebbe @ 7/21/2008 7:58:46 AM
RE: Changes to a view through a grid Posted by Steven Rebello @ 7/22/2008 6:40:45 PM
RE: Changes to a view through a grid Posted by Stefan Wuebbe @ 7/22/2008 7:31:48 PM
RE: Changes to a view through a grid Posted by Steven Rebello @ 7/23/2008 3:32:12 AM
RE: Changes to a view through a grid Posted by Anders Altberg @ 7/24/2008 2:19:21 PM