Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Requery View
Message
 
To
12/10/1999 04:55:47
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00275302
Message ID:
00275369
Views:
25
INSERT IN myView (field1, field2) VALUES (cvalue1, cvalue2)
=tableupdate(.t.,.t., 'myview')
requery('myview')
John,

A couple of things here. You should check the return value of TableUpdate() to find out if it succeded or not;
INSERT IN myView (field1, field2) VALUES (cvalue1, cvalue2)
IF tableupdate(.t.,.t., 'myview')
   * Success
   requery('myview')
ELSE
   * Update failed, do somehting about it
ENDIF
Secondly, if the table that your view gets data from is also open and buffered in the same data environment then you need to TableUpdate() that also;
INSERT IN myView (field1, field2) VALUES (cvalue1, cvalue2)
IF tableupdate(.t.,.t., 'myview')
   IF TableUpdate(.t.,.t.,"TheTable")
      * Success
      requery('myview')
   ELSE
      * The table failed updating
   ENDIF
ELSE
   * Update failed, do somehting about it
ENDIF
Thirdly, using a forced update as the initial one is a poor desing. You are completely disabling VFP's internal notification of update conflicts. Contrary to what you may think, using a force update does NOT guarantee the update will succeed. it only force the update past an "Update conflict", that is the record having been changed by another user while your view was being worked on. Ther are many things that can cuse an update to fail (broken entwork cable, file server going down, bad NIC board, insufficient rights on teh server, etc.. Using the Force option of TableUpdate() only affects one of those reasons, update conflict.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform