Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with TABLEUPDATE
Message
From
07/04/2007 20:13:11
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
07/04/2007 18:17:18
Randy Wessels
Screentek Business Solutions, Llc.
Phoenix, Arizona, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01213238
Message ID:
01213246
Views:
17
>Hopefully a quick question. I am supporting an old VFP app and I am not that good at using cursors and such. I have a product screen that manages 4 types of products. Each type has a different database view. The view in question (desspview) inclues all the fields on the original table (design). There are two filters in the view. One is hard coded to select that specific type of product. The other is one with a ? - i.e. ?curdescode. The user is able to update a field in the view called embcolor1 by populating a text box and clicking on a button. This is the code that is executed when they click the button:
>
>REPLACE desspview.embcolor1 WITH ALLTRIM(THIS.PARENT.text3.VALUE)
>
>When they exit the screen, they click on the save button and the following code is executed:
>
>TABLEUPDATE(2,.T.,'dspecview')
>TABLEUPDATE(2,.T.,'desspview')
>TABLEUPDATE(2,.T.,'embspecview')
>TABLEUPDATE(2,.T.,'desembview')
>SELE desview
>REPLACE desview.desrevision WITH DATE()
>TABLEUPDATE(2,.T.)
>THISFORM.RELEASE
>
>In the end, the table design is not updated. I am being told this used to work but no longer does. I don't believe any changes to this area of the system has been made in years. Any ideas?

TableUpdate() can fail for several reasons. The programmer should check whether it was successful, and why it wasn't.

Some reasons a TableUpdate() might fail:
  • The table is R/O.
  • A field or record rule is violated.
  • RI is violated.
  • Some other trigger is validated (RI is implemented through triggers, too).
  • Update conflict (another user tries to save data at about the same time).
  • Disk full.
  • Insufficient access rights. This happens especially on shared drives.

    Sample code:
    local laError
    if not TableUpdate(...) && TableUpdate() returns .T. if successful
      aerror(laError) && Copy error information to an array
      MessageBox("Error saving table xyz, error #" + transform(laError(1));
        + " error message: " + laerror(2)
    endif
    Of course, you should do this check for every table you save.

    You might also check whether the view definition changed.

    HTH,

    Hilmar.
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Previous
    Next
    Reply
    Map
    View

    Click here to load this message in the networking platform