Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to know records were edited or deletion by Other use
Message
From
20/10/2000 10:55:20
 
 
To
20/10/2000 10:19:44
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00430813
Message ID:
00432080
Views:
20
Hi!

>since we have discuss alot about getfldstate, oldval and curval().
>From what "lesson", our program need to check the changes in current workarea, and also changes on server. Any changes will need user to response such as overwrite all, view changes, and so on. Then, the save procedure in COM (if it is in middle tier) will be break once it need user to response. How should we design in order to accomplish this purpose? Or we just re-run the same save procedure and pass approriate parameter e.g. "force overwrite, vew changes" to tell save procedure to do wahat it need? (just an stupid example)

Of course, you're right! In addition, showing messageboxes inside of transaction (such saving performed usually inside of transaction) is quite bad idea because transaction should last as little as possible because records locking.

So, saving session calling sample for your COM object may look like following:
MyChangeString = ...
lcResult = goDataHandler.Save(MyChangeString, <b>.F.</b>)
* data about changed fields sent as XML string in MyChangeString
* COM object updates data using that string and return result - 
* empty string - successful, non-empty string - failed.
* if failed because something changed on server, we ask user to overwrite changes
* lcResult also contains description of fields and their values that are
* changed by other user. We use this to show to user.
* You can also parse it and show confirmation dialog for each field if required
IF !empty(lcResult)
  IF LEFT(lcResult,7) = 'CHANGED'
    if Messagebox("Data on server changed by another user. Please verify if you need to overwrite changes."+ ;
         CRLF + lcResult, MB_OkCancel+MB_Question) = IDOk
      && save with overwriting
      lcResult = goDataHandler.Save(MyChangeString, <b>.T.</b>)
      if !empty(lcResult)
        && error updating data
      endif
    endif
  ENDIF
ELSE
  && error...
ENDIF
>
>Any real and simple example?
>
>Thank you
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform