Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh Problems with Remote View/Grid 1

Status
Not open for further replies.

kindred

Programmer
Feb 28, 2001
50
US
I've been trying to attack this all different ways. I'm unable to update my grid that contains a remote view of a foxpro table on a server.

The only time it actually updates is if I restart the program or click on a row in the grid.

The things I've currently tried are the REFRESH() cmd on the view (with a complete count of the actual table and/or view, i tried it both ways), REQUERY() the view, refreshing the grid and setfocus on the grid.

All of which are not updating it automatically by my timer or by a CommandButton I have added.

The table and View is set to Opt. Table Buffering.
The refresh is set to 1.5.

Any suggestions/ideas would be very helpful

Thanks,
Stephen
 
Hi!

Use following sequence of commands :
=sys(1104) && purge unused buffers. This also immediately
&&refreshes all internal buffers for tables so you force
&&SET REFRESH setting to work immediately

refresh()
Grid.Refresh

If you want to use Requery for view, do following:
Grid.RecordSource = ""
requery("MyViewName")
Grid.RecordSource = "MyViewName"
* restore ControlSource of each column if needed...
...

Hope this helps.


Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
I haven't tried the =SYS(1104) command yet, but i have tried everything else, sometimes it works successfully, other times it doesn't.

When i try using the REQUERY() cmd, it resets the record pointer to 1. If i store the record pointer and then run requery and goto my stored record pointer, it scrolls around and has a noticable refreshing problem.

Id also like to try and explain what I'm doing as well..
I have a shared database accessed by about 50 employees on a LAN. When a employee makes an update, they only access/update their own record. No other record is updated. So potentially no record can have any conflict updating its own record. When I send a SQL update to the db, I then run a TABLEUPDATE() as well to update it asap.

The grid is based on a view of the table as well, the grid's columns are set to disabled. This is done to give them the effect that they cannot make changes directly to the grid. I tried using the readonly property, but this didn't give the effect i was looking for.

Thanks,
Stephen
 
Hi!

Well, see my FAQ article at the site about refreshing of grid. The sample posted there applies to your case too. There are no way to restore record after requery() and refresh grid so it will look like it not scrolled. You can just make it scrolled as good as possible, nothing more.

You can use refresh() command for view. This will not scroll grid. For immediate refresh use sys(1104) function, so buffers will be refreshed too.

Finally, check if your data really updated before you use refresh() or requery(). If your view is based on VFP database, view's tables are opened too. When thes etables are in buffering mode, you have to use tableupdate() for tables too after you called tableupdate for view. Or just drop any buffering from tables.

Have no otehr ideas. Just look around, don't look to the problem only.

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top