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!

cursor adapter not updating

Status
Not open for further replies.

AlastairP

Technical User
Feb 8, 2011
286
AU
I have a form with a cursor adaptor called cSites which accesses a local table called sites

I refresh the cursor with

Code:
Requery("cSites")
which works OK for the most part except -

I have another program which also access the same database and table

Code:
OPEN DATABASE  (lcAddress) SHARED  
USE sites SHARED IN 0 again  

&& Do stuff

use in sites
close databases all

The second program runs and accesses the table "Sites", updates the records as required, then is closed.

Then when I re query the cursor adapter in the first program it does not update from the main table.

If I do
Code:
Select * from sites into cTemp
select cTemp
browse

I see can see the updates - but the cursor adapter will not update and show the changes. If I close and reopen the first form, the records will update







 
In addition to Olaf's good advice, you probably don't want CLOSE DATABASES ALL in the second program, since it'll close all tables.

Tamar
 
I was under the impression that when a database is opened from two separate executable application's, the database would be scoped to the executing program, and any tables closed in one application would stay open in the other?

I have used
thisform.dataenvironment.cursoradapter.RefreshCursor() before, but in this case did not work,

However I found a work around that does work, but does not explain why this happens in the first place

Code:
thisform.dataenvironment.caSites.nodata=.t.
thisform.dataenvironment.caSites.cursorfill()
thisform.dataenvironment.caSites.nodata=.f.
thisform.dataenvironment.RefreshCursor()
The above empties the ca
Then fills it just like when the form loads







 
>when a database is opened from two separate executable application's, the database would be scoped to the executing program
That's right. Tamar must have assumed PRGs, two PRGs can run in the same process,exe.

If you want data from the start, then sete nodata = .f.
If you used the builder the init code then will do a cursorfill() with data automatically, and in your own code you'll just have to call CursorRefresh, nothing else.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top