locked
tables update RRS feed

  • Question

  • I have 3 tables

    table01

    table02

    table03

    and put them in buffering mode

    and i do all change and then update them through

    =TABLEUPDATE(1,.t.,'table01')

    =TABLEUPDATE(1,.t.,'table02')

    =TABLEUPDATE(1,.t.,'table03')

    some time no update happen for one of then

    what can i do to

    if no update of one of them application reverse the other table update

    how can i check that all of them are updated

    be note that it's network application with about 30 users at the same time

    Sunday, December 16, 2012 1:16 PM

Answers

  • IF TABLEUPDATE(1,.t.,'table01') AND TABLEUPDATE(1,.t.,'table02') AND TABLEUPDATE(1,.t.,'table03')
      *-- Everything OK
    ELSE
      *-- Process the error
      LOCAL laErrList[1]
      = AERROR(laErrList)
      *-- Store the laErrList into the errorlog file
      *-- LIST MEMORY LIKE laErrList TO FILE ("<Your error log file name>") ADDITIVE 
      *-- Inform user about the error
      MESSAGEBOX("Error when updating data", 16, "Error")
      *-- etc.
    ENDIF
    This is just a short code sample. You should process the error in a standard way used in your application.
    • Marked as answer by Alaa Mukhtar Tuesday, December 18, 2012 9:33 AM
    Monday, December 17, 2012 2:45 PM
  • In addition to Pavel's suggestion, if you want to update all of them or none of them, use a transaction. Start with the topic "Managing Updates Using Transactions" in Help.

    Tamar

    • Marked as answer by Alaa Mukhtar Tuesday, December 18, 2012 9:33 AM
    Monday, December 17, 2012 9:57 PM
    Answerer

All replies

  • TABLEUPDATE() returns some value which represents the action success. You have to check this value. If TABLEUPDATE() fails then you can receive more info from AERROR().
    Sunday, December 16, 2012 3:15 PM
  • can you explain your idea with example
    Monday, December 17, 2012 2:23 PM
  • IF TABLEUPDATE(1,.t.,'table01') AND TABLEUPDATE(1,.t.,'table02') AND TABLEUPDATE(1,.t.,'table03')
      *-- Everything OK
    ELSE
      *-- Process the error
      LOCAL laErrList[1]
      = AERROR(laErrList)
      *-- Store the laErrList into the errorlog file
      *-- LIST MEMORY LIKE laErrList TO FILE ("<Your error log file name>") ADDITIVE 
      *-- Inform user about the error
      MESSAGEBOX("Error when updating data", 16, "Error")
      *-- etc.
    ENDIF
    This is just a short code sample. You should process the error in a standard way used in your application.
    • Marked as answer by Alaa Mukhtar Tuesday, December 18, 2012 9:33 AM
    Monday, December 17, 2012 2:45 PM
  • In addition to Pavel's suggestion, if you want to update all of them or none of them, use a transaction. Start with the topic "Managing Updates Using Transactions" in Help.

    Tamar

    • Marked as answer by Alaa Mukhtar Tuesday, December 18, 2012 9:33 AM
    Monday, December 17, 2012 9:57 PM
    Answerer