 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Robert Cerny Guest
|
Posted: Mon Sep 15, 2003 5:41 pm Post subject: Re: Handling multiple users |
|
|
Use a trigger to do validation or a stored procedure to do validation and
update.
--
Robert Cerny
DelphiShaman
"Kris" <noreply (AT) nomail (DOT) com> wrote
| Quote: | Suppose I have a multiuser app accessing a SQLServer database, and when a
user want to update some data, certain condition A must be valid (for
example, some query must return no records).
Suppose condition A is valid:
Query.Open;
if Query.RecordCount = 0 then <<-- A is Valid
begin
// Let the user update the database
SomeTable.Edit;
...........
SomeTable.Post; /// <<-- After post is executed, A is no longer valid
end;
Now: suppose that after RecordCount = 0 is checked, and just before the
.Post, A is no longer valid because another user made modifications to the
DB: then the app will be in an invalid state.
How to solve this problem? With transactions? Locking exclusibly the table
where Query consults?
Thanks
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|