Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C# replacement for VFP code
Message
From
10/11/2006 03:24:02
Walter Meester
HoogkarspelNetherlands
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01167122
Message ID:
01168678
Views:
16
Kevin,

OK, another question.
Since you advertise SPs to do updates, can you tell me how YOU handle the following.

If using remote views, in a GUI, I update a certain field in a certain record, only the changed field for that record gets updated. In the form of:
UPDATE Table SET Field = Newvalue WHERE TablePk = CurrentPk
In a SP you generally pass all fields as parameters, and are forced to update the whole record. You can use a timestamp to check whether the record has changed in the mean time (correct?) Generally this is done in the way of
UPDATE Table SET Field1 = Value1, Field2 = Value2, .... WHERE TablePk = CurrentPk AND TimeStamp = CurrentTimeStamp
And this statement will fail not update the record when someone else has updated the record meanwhile.

What happens in your application (And I have talked through quite a few IT persons asking this question) if two users request the same record at a time, change two different fields and want to save the record ??

In our applications we use the first approach so that there essentially is no problem. The two workstations save without a problem. Note that in remote views there are some other settings like also including the changes field into the where clause. So IOW:
UPDATE Table SET Field = Newvalue WHERE TablePk = CurrentPk AND field = oldvalue
And if you want to do it the SP way, you could do a:
UPDATE Table SET Field = Newvalue WHERE TablePk = CurrentPk AND timestamp = currenttimestamp = oldvalue
Please tell me what you do ?? and which approach is more flexible ??

Walter,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform