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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SUCCESSFULLY SAVE

Status
Not open for further replies.

remsor

Programmer
Nov 5, 2002
101
PH
VFP EXPERTS,
Is there a way that i can detect if the data is save successfully to the table. I encountered sometimes that the data was lost while the save procedure is successfully perform. The table is share with 14 work station.

Thanks
 
remsor

The result of TABLEUPDATE() can be stored into a variable.
Code:
SELECT myTable
lRetVal = TABLEUPDATE(0,.t.)
IF lRetVal = .t.
  messagebox("Records were saved!")
ELSE
  messagebox("Records were not saved!")
endif


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
As an alternative to Mike's code
Code:
[COLOR=blue]lRetVal = TABLEUPDATE(0,.t.,[myTable])
IF lRetVal = .t.
  messagebox("Records were saved!")
ELSE
  messagebox("Records were not saved!")
endif[/color]
It allows you to save a table that is not currently selected.


FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.com
PDFcommandertm.co.uk


 
Mike and Chris,

In order to get the required reply from TABLEUPDATE(), I think you will need to pass .F. as the second parameter.

If you pass .T., and if the save does not succeed (for example, because of a failed trigger), I believe you will get a run-time error.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
remsor,
Just to be clear, tableupdate() will only indicate that VFP was notified by the OS that was requested to write the data that it was successfull. Of course that OS can actually be holding it in a buffer, or it's disk's caching controller. If you want to know that it has been abosolutely, positively successfully written to disk, there is no way to programatically know for certain.

Rick
 
Mike,
Even that's no guarantee - you could be "reading" it from the cache. The file server OS often keeps very large caches, and because statistically the area around previous reads and writes are more likely to be required, they use this as the data source rather than do a physical read. This technique also speeds up data access on a busy file server.

The reason I'm so sensitive to this, is a while back, I was sure I could "prove" when data was written to disk, and was shown how wrong I was by someone much smarter than me. Note: Real servers with write behind caching and Raid controllers make it likely that data will very soon be physically on disk. However, in my experience many FoxPro data servers are peer-to-peer systems or minimally configured servers and don't have the sophistication of real servers!

Rick
 
Thanks for your ideas experts... Hope dat ur ideas will answered my question.... thanks again..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top